Tuesday, March 17, 2009

Creating a VIP on Linux

If you want to have two or more ip addresses on one physical interface, in Linux, there are many ways to do it, but to have a change permanent you have to do these steps on Redhat Linux and probably other distros:

Make a copy from the physical interface startup config file:
cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0

Modify the /etc/sysconfig/network-scripts/ifcfg-eth0:0
DEVICE=eth0
BOOTPROTO=static
HWADDR=00:53:52:A2:43:43
IPADDR=192.168.100.30
NETMASK=255.255.255.0
ONBOOT=yes
TYPE=Ethernet
MACADDR=00:53:52:A2:43:43

Finaly, do a :
# ifup eth0:0