How to add a single or multiple IP addresses to a network interface using network alias.
CentOS Single IP address
Copy etc/sysconfig/network-scripts/ifcfg-eth0 file as /etc/sysconfig/network-scripts/ifcfg-eth0:0 # cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0 Open file /etc/sysconfig/network-scripts/ifcfg-eth0:0 using vi text editor: # vi /etc/sysconfig/network-scripts/ifcfg-eth0:0 # The file should look something like this:
DEVICE=eth0:0 IPADDR=192.168.1.7 NETMASK=255.255.255.0 NETWORK=192.168.1.0 ONBOOT=yes NAME=eth0:0
CentOS Multiple IP addresses range to primary network interface:
You can assign multiple ip address range as follows to eth0: vi /etc/sysconfig/network-scripts/ifcfg-eth0-range0 Append following code from 202.54.112.120 to 202.54.112.140:
IPADDR_START=212.54.112.120 IPADDR_END=212.54.112.140 CLONENUM_START=0 NETMASK=255.255.255.0
# service network restart