For a small range of IP addresses, you can manually add each of them to a file named ifcfg-eth0:x under /etc/sysconfig/network-scripts/. For example, if you want to add 4 IP addresses, you can create 4 files under /etc/sysconfig/network-scripts/ like ifcfg-eth0:0, ifcfg-eth0:1 etc. Each of them will contain something like this:
But, what if want to add 100 or 1000 IP addresses? Is it feasible to sit and add each one of them? Fortunately, RedHat flavors offer a much easier way to bind a range of IP addresses.
You can create a file named “ifcfg-eth0-range0” under /etc/sysconfig/network-scripts/. The file content should be something like this:
IPADDR_START :-> The first IP address that you want to bind with your network card.
IPADDR_END :-> The last IP address that you want to bind with your network card.
CLONENUM_START :-> The number which will be assigned to the first IP alias interface. If your Internet interface is eth0 and CLONENUM_START is 0, then this config file will create 200 interfaces starting with eth0:0 and ending with eth0:199.
If you want to add a second range with 100 IPs, create a new file named “ifcfg-eth0-range1” and set the CLONENUM_START to 200. Otherwise, there will be conflicts with IP addresses and network won’t come up.
When you make changes to the network-scripts, you should restart the network.
# /etc/init.d/network restart
# service network restart