cPanel

How To Update cPanel’s IP Address?

In this article, we will explain to you How to modify the primary IP of your cPanel server.

Introduction:- Before making any changes, we strongly advise communicating with your network or system administrator. If the interface is not configured correctly, the server may become unreachable, and these updates will not be supported by Cpanel.

The IP allocated to the network interface is used by cPanel. Since there is no approval in the WHM interface of cPanel, we recommend that you assist your system administrator or network team.

To change the primary IP address, you must know how to use a command-line text editor to update the system’s network configuration file, cPanel’s MainIP file, restore nat, and transfer your certification.

Follow the following steps

1. Access the “WHM” interface.

2. Select the “Server Configuration” tab now

3. Click on the “Basic cPanel & WHM” Setup button.

In the section “The IP address (only one) that used for configuring shared IP virtual hosts,” change the main IP address. This will make changes to the file /etc/wwwacct.conf.

Then, using SSH, modify the IP address in the network configuration file.

Here's an example of a CentOS configuration.Configuration files for networks

To change the IP address, edit the /etc/sysconfig/network-scripts/ifcfg-interface name > file and replace the old IP address with the new address on the line that looks like :

(IPADDR=192.168.2.203 and GATEWAY= with the new correct gateway) The file name will be ens# or eth#.

After that, update the main IP in /var/cpanel/mainip, replacing the old with the new IP.

If the new IP address previously applied to the server via:

Home » IP Functions » Add a new IP address

This removed from /etc/ips or via the WHM interface.

Home » IP Functions » Display or Remove Current IP Addresses

also need to update the /etc/hosts file to reflect the new IP address. This is possible with the fixed host’s script.

/scripts/fixetchosts

To make the changes take effect, restart the network service and rebuild NAT with the build cpnat script. If the server does not use NAT, the build cpnat script will exit without error.

service network restart && /scripts/build_cpnat > /dev/null 2>&1

Note –You need to disconnect at this point and will need to log in again using the new IP address.

Restart the ipaliases script to bring up the additional IPs if you had them.

service ipaliases restart

To validate the settings, run “ifconfig” to ensure that everything appeared as expected, and then update the cPanel license to the new primary IP and ensure that you can still log in to WHM without any warnings.

That will complete changing the IP for your WHM. 

We hope that you now have a good understanding of How Do You Update Your cPanel’s Primary IP Address. If you continue to have problems with the protocol outlined above, please contact the bodHOST Team.

Leave a Reply

Your email address will not be published.