Add Range of IP Addresses to Interface (RedHat-based systems)
Sometimes you need to add a range of IP addresses to an interface. A good example is configuring a firewall, where you need all of your public IP addresses to be bound to one interface. One way to do this is to create separate ifcfg-eth0:x files for each IP address that you need. This works for a couple of addresses - after that, it gets tedious and messy to maintain. On RedHat-based systems, you can bind multiple IP addresses to an interface with a single file. Create (or modify) the file /etc/sysconfig/network-scripts/ifcfg-ethx-range0 (where x is the interface number). For our example let's assume we're modifying eth0. Insert (or modify) the following lines in this file (ifcfg-eth0-range0):
IPADDR_START=192.168.0.10 IPADDR_END=192.168.0.20 CLONENUM_START=0 NETMASK=xxx.xxx.xxx.xxx
This will create additional IP addresses on the eth0 interface, starting with 192.168.0.10 and ending with 192.168.0.20. The aliased interfaces will be eth0:x, with x starting at the number specified by CLONENUM_START. NETMASK obviously specifies the network mask to use.
You can specify additional ranges by creating additional files with the same naming convention, but using a different number after range (i.e. ifcfg-eth0-range1). Note that you need to be careful when specifying CLONENUM_START in any additional ranges, so as not to overwrite previously specified aliases.
