User Tools

Site Tools


redhat:networking:setup_virtual_ip

Redhat - Networking - Setup virtual IP

A virtual IP is an ip that bind to a physical ethernet card that already has a physical ip address.

1. Add virtual ip to eth0.

Here is the 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
/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 a new virtual configuration file by copying and editing the ifcfg-eth0 configuration file.

Change the IPADDR and remove HWADDR.

cd /etc/sysconfig/network-scripts
cp ifcfg-eth0 ifcfg-eth0:0
vi ifcfg-eth0:0
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
redhat/networking/setup_virtual_ip.txt · Last modified: 2021/01/08 11:57 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki