MThornton

Member
May 3, 2018
8
0
1
Texas
cPanel Access Level
Root Administrator
I inherited a server that I need to move to new internal and external ip addresses. I have tried at least five times following instructions I have found on the subject and all I manage to do is blow up the networking of the virtual server and have to reload the snapshot. Some guidance would be appreciated.

Currently:
the Basic WebHost Manager Setup Config IP address is xx.xx.240.36 (external)
the system has a second address listed in the IP Functions Show IP Address Usage xx.xx.240.35 (external)
ens192 has a local ip of 192.168.10.10 assigned as the main/shared IP for root and website1 and the public IP xx.xx.240.36
ens192:cp1 has a local ip of 192.168.10.13 dedicated to website2 and the public IP xx.xx.240.35, shows as dedicated to website2

I don't know why there are two internal and external IP addresses, and I don't understand how to change them so that everything works in the end. If moving to a single internal and external IP address makes this easier that would be fine.

What I am hoping for:
external IP of xx.xx.97.163/28
internal IP of 10.0.50.10/24
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,496
1,009
313
cPanel Access Level
Root Administrator
Hey there! There isn't an officially-supported way to change the NAT configuration after the initial installation. However, I've had good luck with the following procedure, but keep that image backup handy just in case. We aren't responsible for any breakage that happens because of these steps, as each server can be a bit different.

What I can't help with is how the OS sees and interacts with the public and private IPs - that part is going to be up to the datacenter making sure things are assigned and routed properly to the system.

What I can help with is to make sure they are working in Apache and cPanel once they are assigned to the system.

Normally what I would recommend doing is this:

-get the new IPs assigned to the box
-confirm they are working with ping/other network tools
-you'll want to plan the DNS changes in advance, so whether that is lowering TTLs for all domains or for the nameservers or however you are handling that
-Delete the old IPs you no longer need to avoid confusion
-build the NAT on the server with the /scripts/build_cpnat command (1:1 NAT | cPanel & WHM Documentation)
Once the NAT is built, it should give you positive output that it was able to link each private IP to each public IP. If not, something else is up with the network settings at a level deeper than cPanel

If the NAT configuration went well, you can then do a partial run of the WHM >> IP Migration Wizard to update the cPanel and Apache entries, but we do not want to run the entire tool as that would also break your DNS.
  1. Run IP Migration Wizard
  2. Use the internal IP in the "new IPs" box
  3. Click Continue
  4. Confirm that "Old IP" is the incorrect external IP that Apache is configured for, and that "New IP" is the correct internal one it should be using
  5. Click Continue
  6. Click Continue on the "modify your servers’ configuration files" page
  7. The wizard should now have output that the Apache and cPanel config files were updated correctly, however DO NOT click continue on this page as it will modify the DNS if you do.
  8. Since the cPanel configuration is now correct, we can rebuild Apache with /scripts/rebuildhttpdconf to use the internal IP in Apache
  9. Now we need to abort the IP Migration Wizard as it will otherwise try to continue from where you left off
  10. To fully abort, ensure the following files are removed from the system (they may not all exist, but you can just run the entire batch of commands anyway)
Code:
/bin/rm /var/cpanel/ipmigrate
/bin/rm /var/cpanel/useripmigratemap
/bin/rm /var/cpanel/ipmigscript
/bin/rm /var/cpanel/ipmigratelock
/bin/rm /var/cpanel/postipmigrate
That's a lot to follow, but if done in that order I would expect things to be successful.