Add Range of IP Addresses to Interface (RedHat-based systems)
Posted by rbTech Staff on 05 January 2012 12:36 PM
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):

This will create additional IP addresses on the eth0 interface, starting with and ending with 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.

(2 vote(s))
Not helpful

Comments (1)
09 May 2014 06:05 PM
Anyway to modify the ifcfg-lo config that would achieve this.

ip a a dev lo
ip a a dev lo

Without using the wacky aliasing construct.

Post a new comment
Full Name:
CAPTCHA Verification 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).