How to reconfigure existing cPanel installation to use NAT ?

onesixright

Member
Apr 24, 2014
8
0
1
cPanel Access Level
Root Administrator
Hi All,

I did try to find within cpanel forum and google for a solution, but nothing satisfactory i found. Lots of old posts about the pre 11.40 version.

We are running cPanel for a while, which was running fine. Yesterday we needed to resize the root partition on our AWS-EC2 instance. After rebooting we got a new internal IP (10.x.x.x). Because the IP changed, all websites went to default web page (i'm sure this something familiar). I quickly fixed the 'default page' problem by replacing the old ip address with the new one in /etc/httpd/conf/httpd.conf. So for the moment it works, but i know you should not make changes to this file directly.

Since 11.40 there is NAT support, however we installed our server before 11.40.

I want to use the NAT functionality (currently we run WHM 11.42.1 (build 12)).

I Tried:
  • /scripts/build_cpnat
  • /scripts/rebuildhttpdconf

The NAT is shown correctly on the 'Show or Delete Current IP Addresses'. But when I restart httpd, i'm back to the default pages for all websites :mad:

Then there are a bunch of files that still have the old 10.x.x.x IP.

So my question is whats the correct way to reconfigure a existing cPanel installation to use NAT?

There also a bunch of files that still contains the old IP (10.x.x.x)

  • /etc/*
  • /var/cpanel/userdata/*/*


Do i need to replace the old ip in all these files by hand? Or is there a script that can fix this?

Many thanks!
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello :)

Please review the contents of:

/var/cpanel/cpnat

Per our documentation:

The list of the public IPs that are associated with the internal IPs will be written to the /var/cpanel/cpnat file one mapping per line: local_ip remote_ip

Also, are the accounts assigned the old IP addresses in Web Host Manager?

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
For instance, when you browse to "WHM Home » Account Information » List Accounts", are the accounts assigned the correct IP address?

Thank you.
 

onesixright

Member
Apr 24, 2014
8
0
1
cPanel Access Level
Root Administrator
Ah, ok. Well the problem is i see both.But i did edit the httpd.conf and did a global find and replace on the old 10.x with the new 10.x IP.

99% having the local 10.37.xx.xx IP, just a few have the external IP (EC2 elastic IP). BUt those i updated with the 'change site ip' function.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
It's better to change the IP addresses via:

"WHM Home » Multi Account Functions » Change Multiple Sites’ IP Addresses"

Rebuilding the Apache configuration file via /scripts/rebuildhttpdconf should revert the changes unless you used the distiller.

Thank you.
 

onesixright

Member
Apr 24, 2014
8
0
1
cPanel Access Level
Root Administrator
But, in that screen it already show the external IP address (54.x.x.x). If i select a domain it tells me 'domain.tld is already using ip 54.x.x.x'. Where in account list it shows the 10.x.x.x IP's :confused:
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Did you already rebuild the Apache configuration file via /scripts/rebuildhttpdconf to revert the manual edits you made?

Thank you.
 

onesixright

Member
Apr 24, 2014
8
0
1
cPanel Access Level
Root Administrator
ok, i now run /scripts/rebuildhttpdconf .

Now i see on 'Change Multiple Sites’ IP Addresses' all domains are set to the elastic IP address (54.x.x.x).
On the 'list accounts' i see the OLD 10.37.xx.xx IP's which should be 10.246.xx.xx?

If I grep 10.246.xx.xx from /etc/httpd/conf/httpd (date time is changed) i see all websites be set to 10.246.xx.xx (thats the new IP, which looks good).
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Feel free to open a support ticket using the link in my signature so we can take a closer look. You can post the ticket number here so we can update this thread with the outcome.

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
I am happy to see the issue is now resolved. Thank you for updating us with the outcome.