Introduction
You may want to change the IP address that your server uses for it's cPanel IP address. The following provides information about what is required to do this.
The short answer to this is that you must contact your hosting provider or a network administrator that has the skills, training, and experience required to modify the network configuration of your server to change the MainIP of your server. The MainIP of your server is the default outbound IP address.
The following information provides additional context to assist with understanding what the server's MainIP is.
First, it is very important to understand the technical difference between the server's MainIP and Main SharedIP. It is very common to get these two confused, and it is also possible to improperly configure your server if try to change one without properly updating the other as well.
What is the server's Main SharedIP?
The server's Main SharedIP, is configured via WHM at:
Home »Server Configuration »Basic WebHost Manager® Setup »Basic Config
This IP address is the IP address that new accounts will be assigned to when they are created.
NOTE: You can also view this IP address via SSH as the root user with the following command:
grep "ADDR " /etc/wwwacct.conf
What is the servers MainIP?
The server's MainIP address is determined by the network configuration of the server. The MainIP is not configurable through cPanel, it can only be modified by a network administrator or your hosting provider.
The MainIP is the IP address that the kernel selects as the default outbound IP address. For this reason, this is the IP address that the cPanel licensing system uses as the IP address of your server.
There are a number of ways that you can test to see what the default outbound IP address is.
1. Use the ip route get command on a remote IP. In the following example, xxx.xxx.xxx.xxx would be your server's default gateway, and yyy.yyy.yyy.yyy represents the default outgoing IP address that the kernel selected:
ip route get 8.8.8.8
8.8.8.8 via xxx.xxx.xxx.xxx dev ens4f2 src yyy.yyy.yyy.yyy
cache
2. Make an HTTP request to a service that shows what IP address the request is coming from. In the following example, yyy.yyy.yyy.yyy represents your server's default outgoing IP address:
curl https://myip.cpanel.net
yyy.yyy.yyy.yyy
3. Run the script that updates your server's MainIP address first:
/scripts/mainipcheck
Then check the file that cPanel uses to keep track of what the MainIP is:
cat /var/cpanel/mainip
yyy.yyy.yyy.yyy
The complexities of how your server determines what IP address to use as the MainIP is outside of the scope of this guide. You must consult with a network administrator that has the skills, training, and expertise required to explain the specifics of how that works on your specific server.
Should My Server's MainIP and Main SharedIP be the same?
Yes, they should be the same. If you have your network administrator change the network configuration of the server to change the MainIP, you should also change the server's Main SharedIP.
If these two IP addresses are different, the server will not be able to obtain a free SSL certificate for the hostname of the server. We have an internal case opened with our development team to fix this issue. Please follow the following article to get an email update when an update to the case is made:
Unable to obtain a free hostname certificate due to 404 when DCV check runs
How to Change the Server's MainIP address
As stated previously in this article, the only way to change the server's MainIP (default outbound IP address) you must contact your hosting provider, or a network administrator that has the skills, training, and expertise required to update the network configuration of your server so that it uses the desired IP address as the default outbound IP.