Adding A Range of IP Addresses in CentOS

Posted
Comments None

Debian based systems doesn’t provide an easy way to add a range of IP addresses. Under CentOS this can be achieved by creating a special file under /etc/sysconfig/network-scripts. For each range of sequential IP addresses, create a file named ifcfg-ethX-rangeY, replacing X with your network interface and Y with a sequential number starting with 0, e.g. ifcfg-eth0-range0.

IPADDR_START=192.168.100.1 IPADDR_END=192.168.100.10 CLONENUM_START=0

There are starting IP and ending IP which are self explanatory. Note the COLENUM_START configuration parameter which specifies the starting alias. In this example it will create a total of 10 aliases named eth0:0 … eth0:9.

If you’d like to specify another range, you have to properly calculate the value for the next COLENUM_START, e.g. creating ifcfg-eth0-range1 will look like:

IPADDR_START=192.168.200.1 IPADDR_END=192.168.200.10 CLONENUM_START=10

Once you’re done with the configuration, you can start the new IP addresses by typing:

/etc/sysconfig/network-scripts/ifup-aliases eth0


There are currently no comments on this article.

Comment

Enter your comment below. Fields marked * are required. You must preview your comment first before finally posting.





← Older Newer →