Tuesday, April 28, 2009

Assign Virtual IPs to your NIC

Edit file /etc/sysconfig/network-scripts/ifcfg-eth0.



DEVICE=eth0

BOOTPROTO=static


BROADCAST=192.168.0.255


HWADDR=00:00:00:00:00:00


IPADDR=192.168.10.2


NETMASK=255.255.255.0


NETWORK=192.168.10.0


ONBOOT=yes


TYPE=Ethernet


GATEWAY=192.168.10.1


 


Make a copy of this in the same directory naming the new file ifcfg-eth0:1


# cp ifcfg-eth0 ifcfg-eth0\:1


 



Modify /etc/sysconfig/network-scripts/ifcfg-eth0:1 file. Modification are in bold

DEVICE=eth0:1


BOOTPROTO=static


BROADCAST=192.168.0.255


HWADDR=00:00:00:00:00:00


IPADDR=192.168.10.101


NETMASK=255.255.255.0


NETWORK=192.168.10.0


ONBOOT=yes


TYPE=Ethernet


GATEWAY=192.168.10.1



 

# cp ifcfg-eth0\:1 /etc/sysconfig/networking/devices/


# cp ifcfg-eth0\:1 /etc/sysconfig/networking/profiles/default/



 

Now, bring up the new interface using the ifup script:


# ifup eth0\:1


Running ifconfig, the new interface should be listed. You can also check it by pinging:


# ping 192.168.10.101

No comments:

sanjay's shared items

My Blog List