Changing a server to a new IP is a nightmare, there is so many places that need to update. If possible always just set up a new server and transfer everything to it. If that’s too hard than here is how to do the migration the best possible way.
- Edit /etc/sysconfig/network-scripts/ifcfg-eth0
Change the IPADDR and GATEWAY lines to match the new IP and Gateway for the new ip
- Edit /etc/sysconfig/network
Change the GATEWAY line here if it does not exist in the ifcfg-* file.
- Edit /etc/ips
Remove the new primary IP from this file if it is present
Add the old primary IP to this file
- Edit /var/cpanel/mainip
Replace the old primary IP with the new primary IP
- Edit /etc/hosts
Replace the old primary IP with the new one if needed. The hostname’s dns will need to be updated too
- Restart the network service to make the new IP the primary: service network restart
(Note: You’re probably going to be disconnected at this point, and have to log in to ssh using the new primary ip.)
- Restart the ipaliases script to bring up the additional IPs: service ipaliases restart
- Run ifconfig and make sure all IPs show up correctly
- Update the cpanel license to the new primary IP
- Then run /usr/local/cpanel/cpkeyclt to update the CPanel license
- Then run the migration Wizard inside CPanel to update Apache and the website settings.
In a perfect world that will do it.