[FrontPage] [TitleIndex] [WordIndex

This is a read-only archived version of wiki.centos.org

Virtual IP addresses

You can add several virtual IP addresses to a physical network interface. A good starting point is to copy the interface definition file of the device you want to add a virtual IP address to.

cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0 

You may have to modify ifcfg-eth0 to match your physical interface name.

Now you can edit the new file ifcfg-eth0:0 and specify the network settings of the virtual interface.

If you want the virtual IP address come up on boot, you need to remove

ONBOOT=YES

and make it

ONPARENT=YES

This makes the interface only come up when the parent interface comes up, while ONBOOT=YES would pull up the parent interface even if that is configured to not come up on boot.

To make the changes take effect please restart the network services using:

service network restart

2023-09-11 07:23