Two methods. The second method has been verified to be simpler.
In this short post I will show you how you can quickly add Range of IPS On any RedHat Based System ( RHEL, centos, Fedora , Etc). When you have to add multicast IPs to a system this can be quite handy and save a lot of time.
Normally when you add a new IP to a network interface in a RedHat based system you create a file Ifcfg-eth0: x In /Etc/sysconfig/network-scripts/ . For example:
/Etc/sysconfig/network-scripts/Ifcfg-eth0: 0 Device = Eth0: 0 Onboot = Yes bootproto = static ipaddr = 192.168.0.100 netmask = 255.255.255.0 network = 192.168.0.0 broadcast = 192.168.0.255 type = Ethernet
Similar to the above example you can create several aliases. But what if you have to add a lot of IPs that are in a range like this? Let's say that I want to add 100 IPS this way... This is possible, but not very valid tive, right? RedHat based systems offer a method to bind a range of IPs in a quick way allowing us to eliminate the need to create a lot of files and saving us time doing this.
Create a file /Etc/sysconfig/network-scripts/ifcfg-eth0-range0 If this doesn't exist, or just add to it if you already have it, the following lines:
/Etc/sysconfig/network-scripts/ifcfg-eth0-range0 ipaddr_start = 192.168.0.100 ipaddr_end = 192.168.0.200 clonenum_start = 0
Where:Ipaddr_start Is the first IP and Ipaddr_end Is the last IP in the range. Clonenum_start Is the number that will be assigned to the first IP alias interface (eth0: 0 in this example ).
If you need to add more ranges of IPS then just use a different file for ex.Ifcfg-eth0-range1 , For each one of the ranges. You need to be careful and use the proper Clonenum_start To 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
Note: Don't use this method onCpanel Based System. Even though this will work fine, it is better to use cpanel/whm in this case so cpanel can manage all the IPS properly. here is a short post on how you can do the same thing 'cpanceway '.