Add a series of IP addresses in linux.

Here I am talking about Redhat/Centos.. Not Debian versions…

I got into a situation where I have to add atlease 64 public IP address to an interface.
If I do it manually then it is going to to take lot of time.Also lot of mistakes..
Googling given me this solutions.

Say for example you want to give multiple ips to the eth0 interface.

1. Go to the network inteface directory

/etc/sysconfig/network-scripts

2.Create a special interface file as below

vi ifcfg-eth0-range0
IPADDR_START=11.12.13.14
IPADDR_END=11.12.13.78
CLONENUM_START=14
NETMASK=255.255.255.0

Here starting IP address is 11.12.13.14 and Ending IP Address is 11.12.13.78.
Clonenum Start indicates virtual interface starting number. Say, for example in this case the fist virutal
interfaces will be eth0:14,eth0:15 and so on.

3.Restart the network

/etc/init.d/network restart

Saved at-least an hour.!!

Leave a Reply