Administration CentOS Debian Fedora Linux Ubuntu

Assign range of IP addresses to an interface.

Sometimes you may need to assign a wide range of IP addresses to your network interface in Linux systems. Instead of manually creating aliases for the network interface, it is much quicker to use the network ip range instead.

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

service network restart

Related Articles

  • How to List Compiled PHP Modules from the Command Line

    The general command is php -m; this command will give you the full list of extensions: php -m This command will give you an output like: bz2 calendar Core ctype...
  • TOP 50 LINUX COMMANDS

    Linux can be extremely scary. However, it is always great to have your hands on these nifty commands since you will have to use them all the time as a...
  • Purging and Loading assets onto your CDN

    Step 1: Login to the Webair EZPanel (https://ezpanel.webair.com) Step 2:¬†On the left side menu, click on CDN.   Step 3: Click on the “Webair CDN” button. This will open up...
  • How to Manage a Linux Server with systemd

    What Operating Systems Have Adopted systemd? CentOS: Yes, by default since CentOS 7 Fedora: Yes, since the release of Fedora 15 RedHat: Yes Debian: Yes, shipped since Debian 7 as...