Assign range of IP addresses to an interface

For example, you need to assign the IP range 192.168.10.6 – 192.168.10.100 to your eth0 interface.

Create a range file in /etc/sysconfig/network-scripts/ifcfg-eth0-range0 as below

DEVICE=eth0
BOOTPROTO=static
IPADDR_START=192.168.10.6
IPADDR_END=192.168.10.100
NETMASK=255.255.255.0
CLONENUM_START=1
ONBOOT=yes
TYPE=Ethernet

CLONENUM_START is the number that will be assigned to the first IP alias interface (eth0:1 in this example).

If you need to add more ranges of IPs then just use a different file for eg. ifcfg-eth0-range1, for each one of the ranges. Make sure CLONENUM_START does not overwrite other aliases.

Once you have configured the range/s of IPs you just need to restart the network service in order to activate it

Share

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.