Cpanel Server Main IP Change

This KB describes on How to change a Cpanel servers main IP.


Make sure to take a backup of all the files mentioned in this KB.


1: edit /etc/sysconfig/network-scripts/ifcfg-eth0 and replace old server IP with new IP  // assuming eth0 as the primary Device

2: connect the server with LAN IP or IP-KVM

3: restart eth0 device

>> ifdown eth0

>> ifup eth0


3: Edit the following files

>>  /var/cpanel/mainip   //replace old IP with new  IP

>> /etc/ips    //replace new IP with old server main IP

>> /etc/hosts      //replace old IP with new  IP

4: update Cpanel  licence

>> /usr/local/cpanel/cpkeyclt

5: Ran the following script to update domains IP’s

>> for i in `cat /etc/trueuserdomains |cut -d: -f2`; do /usr/local/cpanel/bin/setsiteip -u $i newIP; done    // assuming all domains using the same shared IP’s


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s