(866) 366-3640 - support@sagonet.com
Sago Logo
Banner

   
Log in / create account Page Discussion History Go to the site toolbox
Adding IPs in Cpanel

IP Theft Disclaimer: ALL use of additional IPs must be requested and provisioned. If you use ANY IPs outside the ones originally provisioned it will be treated as abusive activity (IP spoofing) and we may suspend your service. If you need addition IPs provisioned, simply contact us

If you need to add IPs to your Cpanel server you can do so within Cpanel itself, however this often does not work. this seems especially true if the IPs are on a different subnet they do not work correctly when added via Cpanel. However, the matter is pretty easy to fix.

Cpanel Method

You can try adding IPs in Cpanel first. If they do not work, just remove them and use the manual method below.

To add them: In Cpanel just goto the "Add and IP" section in the left hand column and enter them via the Cpanel interface.

To test them: simply ping the address(es) you added. If you get a response, it worked. If they don't ping, time to delete them in Cpanel and move on to . . .

NOTE: When adding IPs in Cpanel, no range files (as made below) are created. The added IPs are put into /etc/ips and the script /etc/init.d/ipaliases runs to configure these IPs. This script must run at startup to initiate these IPs.However this method, especially if using various blocks of IPs with different network masks, often creates conflicts and you may get IPs that don't work correctly. Hence the next section.

Manual Method

To overcome the above, you can just manually create the files which hold information on the IPs assigned to the server. This is easy to do:

0) Remove any additional IPs you have added in Cpanel

1) Log into your Cpanel server via ssh as root

If you are using Windows you will need an ssh client such as Putty: http://www.chiark.greenend.org.uk/~sgtatham/putty/

2) The examples below are for CentOS. If using another distribution, the config file name and location as well the exact changes will be somewhat different - but the overall theory is the same. Your disto's documentation should tell you where to find the the necessary files.

4) Goto where the IP config files are stored:

[root@myserver ~]# cd /etc/sysconfig/network-scripts/

Each interface has one primary configuration file, called for example:

ifcfg-eth0

Each interface can then have numerous additional config files to specify each additional range of IPs. These are called

ifcfg-eth0-range0 

Or ifcfg-eth0-range1, ifcfg-eth0-range2, etc. Each file might hold a block of anywhere from 2 to 10+ IPs. (Each block goes into its own range file.) These range files will actually create virtual interfaces. You may have only one NIC, but if you have one basic and three range files set you you will see a total of four network devices: eth0:0, eth0:1, eth0:2 and eth0:3

If you do not have a range file already you can simply create it - call it exactly ifcfg-eth0-range0To do so execute:

touch ifcfg-eth0-range0

Next, modify this file using vi or nano, etc. to be as follows:

DEVICE=eth0:1            <----eth0:1 Creates the virtual device. This is the first additional IP range, eth0:2 the next, etc. 
ONBOOT=yes
BOOTPROTO=static
NETMASK=255.255.255.0    <----- Your subnet info

IPADDR_START=10.20.30.40 <---- Your first additional IP
IPADDR_END=10.20.30.50   <---- Your last additional IP
CLONENUM_START=0         <---- First file gets zero

NO TYPOS! This file must be perfect or it will not work.

Note the DEVICE=eth0:1 - this increments by one for each new range file. Range file ifcfg-eth0-range0 uses eth0:1, range file ifcfg-eth0-range1 uses eth0:2, etc

The COLNENUM_START= is where most people run into trouble. Unlike the device setting, this does not increment by 1 each time. It nees to be set to a value of: number of IP addresses already assigned + 1. If there are already range files existing you can run:

# ifconfig | grep eth0

Look at the last number, add 1 to it and that is the COLNENUM_START for the next range file.

Once you have added these to the range file save it and restart the networking service with:

service network restart

Notice any errors and if present edit the range file again to correct them.

You can execute ifconfig to see all the ethernet devices and the IPs on each one.

When these look correct just ping them from a remote source and if you get responses you are done!

If you don't get a ping response, and ifconfig appears to show them configured correctly, verify you don't have any firewall rules blocking them.