I've always used the ifcfg-eth0:1 alias files to create additional addresses. However, in recent rhel documentation, it states that:
As the ip command of the iproute package now supports assigning multiple address to the same interface it is no longer necessary to use this method of binding multiple addresses to the same interface.
Furthermore, numerous answers and comments on this site mention that ifconfig is deprecated and that "ip" should be used instead. I'm fine using it for live changes, but how do I persist the changes across reboots without using the alias files?
Put them in
/etc/sysconfig/network-scripts/ifcfg-eth0
, with a2
or3
etc. after them, such as:Unfortunately this seems to be undocumented (or I can't find it right now; it looks like Red Hat rearranged their web site yet again).
On the same page where you pulled that paragraph, it tells you to use
NetworkManager
to assign multiple IP address to one interface.This appears to edit your interface configuration to add:
For what it's worth, it also says that it is no longer necessary to use alias files, but that doesn't mean it doesn't work. (Especially if you need DHCP.) I personally would rather manage my network outside the GUI so you should be able to stop the NetworkManager service and continue business-as-usual with your alias files.
The last option, would be to put your
ip
commands in/etc/rc.local
to be executed at system start. Beware, though, that if the network service is restarted, these settings will not be persistent. This should only be considered as a last resort.Deployment Guide, 8.2.7. Alias and Clone Files