How to change the primary IP address of a WHM/cPanel (centOS/RHEL) based servers?

1. Steps for WHM:

I. Log into WHM >> Basic cPanel & WHM Setup
II. 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"

This might not actually be necessary.

2. Steps using SSH - 

I. Login in to SSH.

II. Edit /etc/sysconfig/network-scripts/ifcfg-eth0
    Change the IPADDR and GATEWAY lines to match the new IP and Gateway for the new ip.

III. Edit /etc/sysconfig/network
     Change the GATEWAY line here if it does not exist in the ifcfg-* file.

IV.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 ::

V. Edit /var/cpanel/mainip
    Replace the old primary IP with the new primary IP.
VI. Edit /etc/hosts
     Replace the old primary IP with the new one if needed. The hostname's dns will need to be updated too.
VII. Restart the network service to make the new IP the primary service network restart.
      /etc/init.d/networking restart
Note: You will be disconnected from current SSH and will need to login new IP address 
VIII. Restart the ipaliases script to bring up the additional IP.
        service ipaliases restart
IX. Run ifconfig and make sure all IPs show up correctly.

X. Update the cPanel license to the new primary IP. You will need to be in touch with the cPanel store from where you've ordred the cPanel license. Once done then fire below command -

XI. Verify you can still log in to WHM and there is no license warning.

XII. Verify cPanel

All done! Smile 

Was this answer helpful?

 Print this Article

Also Read

500 No response from subprocess (/usr/local/cpanel/whostmgr/docroot/cgi/ addon_cwaf.cgi): The subprocess reported error number 2 when it ended.

The 500 internal server on WHM Comodo plugin with below Error Message: [2017-03-04 10:55:43...

Loopback test error: `Operation timed out after 8000 milliseconds with 0 bytes received - WordPress issue

I was getting below while generating backup from BackupBuddy ( in WordPress ) on LiteSpeed server...

How to Install cPanel on CentOS 6 or 7?

How to install cPanel on CentOS 6 or 7.  Please note cPanel does not support any other operating...

Unable to perform operation. No free disk space.

I'm getting this error when I tried to send an email from webmail:Unable to perform operation....

How to Install or Uninstall EasyApache 4 on cPanel server?

EasyApache Software is included within your cPanel and WHM license which is very easy and useful...

Powered by WHMCompleteSolution