Add Range of IPs to RHEL or CentOS

By | November 26, 2013

If you have a full subnet to add on RHEL/CentOS Linux system, there is a short way to achieve this instead of manually create single alias interfaces.

1. Create a file at this location :

vim /etc/sysconfig/network-scripts/ifcfg-eth0-range0

Be sure to name the file as needed, according to the interface you would would have the IP subnet binded to and increment the range number if you have more then one.

2. Add the following with proper values :

IPADDR_START=
IPADDR_END=
CLONENUM_START=
NETMASK=

Here is a sample :

IPADDR_START=192.168.1.2
IPADDR_END=192.168.1.254
CLONENUM_START=0
NETMASK=255.255.255.0

*The “CLONENUM_START” value is equal to the alias interface number you would start with this range. In this case, the first IP (192.168.1.2) will be binded to “eth0:0″.