How To Add A Range of IPs in RedHat Based Systems

You can follow the below given information for binding multiple IPs to an interface:

Create/modify the file /etc/sysconfig/network-scripts/ifcfg-ethX-range0

where x is the interface number.

Example:

We have an interface with name eth0 and we want to bind the IPs starting from 192.168.1.240 and ending at 192.168.1.250.

For that create/modify a file named ifcfg-eth1-range0 in /etc/sysconfig/network-scripts/ and add following to it.

IPADDR_START=192.168.1.240
IPADDR_END=192.168.1.250
CLONENUM_START=0
NETMASK=255.255.255.0

This will assign 11 IP addresses from 240 to 250 on eth0 interface with subnet mask 255.255.255.0.

The aliased interfaces will be the following

eth0:0 -> 192.168.1.240 255.255.255.0
eth0:1 -> 192.168.1.241 255.255.255.0
eth0:2 -> 192.168.1.242 255.255.255.0
eth0:3 -> 192.168.1.243 255.255.255.0
eth0:4 -> 192.168.1.244 255.255.255.0
eth0:5 -> 192.168.1.245 255.255.255.0
eth0:6 -> 192.168.1.246 255.255.255.0
eth0:7 -> 192.168.1.247 255.255.255.0
eth0:8 -> 192.168.1.248 255.255.255.0
eth0:9 -> 192.168.1.249 255.255.255.0
eth0:10 -> 192.168.1.250 255.255.255.0

Notes:

CLONENUM_START is the starting number for the aliased interface name. In our example its “0” and hence the aliased interface name starts at eth0:0.

You can specify additional ranges by creating additional files with the same naming convention, but using a different number after the word “range”, i.e. ifcfg-eth0-range1 and don’t forget about the purpose of CLONENUM_START [when specifying CLONENUM_START in any additional ranges, so as not to overwrite previously specified aliases].

CLONENUM_START ifcfg-eth0-range1