Monday, March 23, 2009

CPanel: adding a range of IPs using WHM

You can add a range of IPs in Cpanel/WHM .This can be easily done using the WHM interface:

Go to IP Functions/Add a New IP Address. Here you can choose the “Ip(s) to add” and the Subnet Mask.

To add the IP range 192.168.0.100-192.168.0.105 you will just have to enter:
Ip(s) to add: 192.168.0.100-105
Subnet Mask: 255.255.255.0
and click on “Do it“.

This will add all the IPs in the range to the system.

In the background CPanel will add for each IP a line in the file /etc/ips:

#vi /etc/ips

192.168.0.100:255.255.255.0:192.168.0.255
192.168.0.101:255.255.255.0:192.168.0.255
...etc

The IPs are then configured using the CPanel startup script called ipaliases (/etc/init.d/ipaliases).

#service ipalias restart