2

I would like to add a virtual IP address, something you normal do with:

ifconfig eth0:0 192.168.1.1

(or via /etc/network/interfaces). But, I'd like to do it from the kernel command-line, which has the command format:

ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>:<dns0-ip>:<dns1-ip>

However, the format for virtual IP names uses a colon, which is in conflict with the kernel command-line format. So for example, the following non-virtual device eth0 works:

ip=192.168.1.1:::::eth0:::

But if I want to use the virtual device eth0:0, the following does not work:

ip=192.168.1.1:::::eth0:0:::

(and I wouldn't expect it to, as the extra colon mucks with the format). Note: doesn't work in this case means it still configures the eth0 device, not the eth0:0 device.

Is there any way to do this?

1

It doesn't seem possible.

The kernel documentation for the ip parameter says the syntax is

ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>:<dns0-ip>:<dns1-ip>

with only one client-ip.

The Linux IP-Aliasing doc says that the colon form is deprecated.

And the ip option simply treats : as a word separator without providing any special way to escape a literal :.

https://github.com/torvalds/linux/blob/master/net/ipv4/ipconfig.c#L1614

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.