IP alias lost when changing main IP

Posted by rmflow on Server Fault See other posts from Server Fault or by rmflow
Published on 2013-11-06T14:47:11Z Indexed on 2013/11/06 15:56 UTC
Read the original article Hit count: 488

Filed under:
|
|

my /etc/network/interfaces:

auto eth0
iface eth0 inet static
    address 192.168.3.75
    netmask 255.255.255.0
    gateway 192.168.3.0

Situation 1:

After linux booted I set an IP alias: ifconfig eth0:0 192.168.3.111

Now ifconfig reports two IP addresses 192.168.3.75 at eth0 and 192.168.3.111 at eth0:0

When I change main IP to another network: ifconfig eth0 192.168.1.111 the alias eth0:0 is lost!

Situation 2:

After linux booted I set an IP alias: ifconfig eth0:0 192.168.4.111

Now ifconfig reports two IP addresses 192.168.3.75 at eth0 and 192.168.4.111 at eth0:0

When I change main IP to another network: ifconfig eth0 192.168.1.111 the alias eth0:0 stays!

How do I properly change main IP, so all my aliases are not lost?

© Server Fault or respective owner

Related posts about linux

Related posts about networking