How to Change the Primary IP Address of a WHM / cPanel server

On CentOS (v7.x) server running WHM cPanel (v58.0.19), the following steps are required to successfully change the primary IP address of the server.

In WHM:
Navigate to IP functions >> IP Migration Wizard
Enter the new IP address and complete all prompted steps

Via SSH:

nano /etc/sysconfig/network-scripts/ifcfg-eth0

then update IPADDR and GATEWAY to the new values, save and exit.

If GATEWAY information does not exist in this file, only then:

nano /etc/sysconfig/network

and update GATEWAY, save and exit.

nano /etc/ips

Replace the old primary IP with the new IP address, save and exit.

nano /var/cpanel/mainip

Replace the old primary IP with the new primary IP, save and exit.

nano /etc/hosts

Replace the old primary IP with the new primary IP, save and exit.

Restart the network, which will terminate your existing connection, command is:

service network restart

SSH back into server using new IP address and check network interface configuration (to ensure new address is in use), command is:

service network restart

In WHM:
Navigate to Server Configuration >> Basic cPanel & WHM Setup
Enter new IP address in appropriate field and save changes

In SSH:
Update the license key for cpanel, command is:

/usr/local/cpanel/cpkeyclt

If license is not properly updated, most likely solution is to log into cPanel (their service portal) and manually reassign the existing license to the new IP address; or contact their support.

Clean up:
DNS: Make sure to update A record, SPF(TXT), PTR (rDNS), etc. records
If the old IP address is no longer required, release it off the server
Wait for nameserver propagation to complete and test access to WHM URL.

Leave a comment

BlogLogistics