How to Change the Primary IP of a cPanel WHM Server

This article provides a guide for how to change the primary IP of a cPanel WHM server. This guide is intended for cPanel VPS and cPanel dedicated server users.

How to Change the Primary IP of a cPanel WHM Server

To change the primary IP of a cPanel WHM server, follow the steps below:

  1. Log into WHM as the 'root' user.
  2. Navigate to "Home / Server Configuration / Basic WebHost Manager Setup."
  3. Change the IP address set for "The IP address (only one address) that will be used for setting up shared IP virtual hosts" to the new IP address.
  4. SSH the server as 'root' user.
  5. Edit the server's network configuration to replace the old network configuration with the new network configuration.
    Please note that the specific file or files to be updated depend on the OS the server is running and the network service running on the server.
  6. Run the /scripts/mainipcheck script to update the main cPanel IP address.
  7. Run the /scripts/fixetchosts script to update the /etc/hosts file.
  8. Restart the network service.
    On RHEL-based servers, run the following command:
    sudo systemctl restart network
  9. Run the /scripts/build_cpnat script if your server is configured for NAT.
  10. You will likely get disconnected at this time and will need to log in again via the new IP address.
  11. Run the /scripts/restartsrv_ipaliases script if your server has additional IP addresses added through the "Home / IP Functions / Add a New IP Address" interface in WHM.
  12. Run the ifconfig command and verify that the correct information is shown.
  13. Once the new IP is correct in your network configuration, make sure your license is updated to continue using WHM.
  14. Verify you can log in to WHM.

Conclusion

You now know how to change the primary IP of a cPanel WHM server.

  • ip address, whm, cpanel ip, cpanel
  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

Disable Network Manager on CentOS 7

This article will provide the steps to disable Network Manager in CentOS 7. Network Manager is...

Disable Network Manager on CentOS 6

This article will provide the steps to disable Network Manager in CentOS 6. Network Manager is...

How to Find the IP of cPanel/WHM Server

This tutorial is designed to troubleshoot and diagnose issues with cPanel license errors. Find...

Uninstall WHMXtra on cPanel Server

This article provides a quick and direct guide for uninstalling the WHMXtra plugin from a...

How to Customize cPanel Installation

This article provides a guide for customizing a cPanel server installation, using the...