…or better, they should not disappear at all.
If you use more than one IP address in the same CIDR network on your Linux box, you may have noticed, that some addresses are labeled as ‘secondary’.
inet 10.10.60.2/16 brd 10.10.255.255 scope global eth0
inet 10.10.60.20/16 scope global secondary eth0
inet 10.10.60.21/16 scope global secondary eth0
Outgoing traffic is routed through the primary IP address and the secondaries are ready to receive traffic. But if you remove the primary IP address
10.10.60.2, all secondary addresses are purged by default as well. This behavior is a little bit annoying and for most of us unexpected.
One workaround would be to change the netmask to
/32 for the secondary addresses, but that's just a workaround and will leave you with a somewhat unclean network setup.
It is better to reconfigure your kernel (since ~2.6.12) to promote secondaries, if a primary address is removed. Just do
echo 1 > /proc/sys/net/ipv4/conf/all/promote_secondaries
and on all devices secondaries get promoted, you can also promote only on a specific device e.g.
eth0 instead of
To change this persistently add the following file
or if you do not have a
/etc/sysctl.d directory, just add the line to your