Linux : How to add IP range on RHEL/CentOS

By | July 12, 2012

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 script at this location :

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

(ajust values as needed, according to the interface you would would have the IP subnet binded to an then the range number if more than one)

2. Add the following with proper values :

IPADDR_START=
IPADDR_END=
CLONENUM_START=
NETMASK=

Here is a sample :

IPADDR_START=10.10.2.1
IPADDR_END=20.10.2.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 (10.10.2.1) will be binded to “eth0:0”.