Virtual ip is an ip that bind to a physical ethernet card that already have physical ip address. To set virtual ip in centos, follow the below steps:
1. We will add virtual ip to eth0. Below is original configuration of /etc/sysconfig/network-scripts/ifcfg-eth0. ifcfg-eth0 is the original configuration file for eth0.
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO=static
BROADCAST=192.168.0.255
HWADDR=00:0C:29:C8:AA:7C
IPADDR=192.168.0.10
NETMASK=255.255.255.0
NETWORK=192.168.0.0
ONBOOT=yes
TYPE=Ethernet
2. Create new virtual configuration file by copying and editing(change IPADDR and remove HWADDR) the ifcfg-eth0 configuration file
# cd /etc/sysconfig/network-scripts
# cp ifcfg-eth0 ifcfg-eth0:0
# vi ifcfg-eth0:0
BOOTPROTO=static
BROADCAST=192.168.0.255
IPADDR=192.168.0.11
NETMASK=255.255.255.0
NETWORK=192.168.0.0
ONBOOT=yes
TYPE=Ethernet
3. Restart network
# /etc/init.d/network restart
4. Check your new virtual ip using ifconfig
# ifconfig
Wednesday, September 28, 2011
Setting virtual ip in centos
11:06 PM
Computer !
No comments
0 comments:
Post a Comment