Centos add virtual IP(s)
Publisher: Psychz Networks, January 05,2015The first step before configuring any IP on any Linux machine is to run
#
ifconfig
this will show you how many other IP addresses are configured.
The following snippet shows that eth1 is the only IP configured on the server.
eth1 Link encap:Ethernet HWaddr 00:25:90:67:09:E5
inet addr:192.168.100.1 Bcast:104.149.3.47 Mask:255.255.255.0
inet6 addr: fe80::225:90ff:fe67:9e5/64 Scope:Link
You can add several virtual IP addresses to a physical network interface.
Create a configuration file called ifcfg-<interface name>:0 in /etc/sysconfig/network-scripts/
The syntax of the configuration will be as follows :
DEVICE="eth0"
BOOTPROTO="static"
ONBOOT="yes"
IPADDR=x.x.x.x
GATEWAY=x.x.x.x
NETMASK=255.255.255.0
TYPE=Ethernet
Then restart the service and you should be good to go.
service network restart