Change Main IP for cpanel/whm server
WHM
- Log into WHM and go to Basic cPanel & WHM Setup
- Change the Primary IP here with the option that says “The IP address (only one address) that will be used for setting up shared IP virtual hosts“.
Log in to SSH Via Putty and do the following:
- 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 with the format ::
- 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
- Restart the ipaliases script to bring up the additional IPRun ifconfig and make sure all IPs show up correctly
- service ipaliases restart
- service ipaliases restart