IP Configuration Issues (NAT) After Changes

Michael Legg

Well-Known Member
Mar 2, 2015
67
4
58
New Farm, Queensland, Australi
cPanel Access Level
Website Owner
Hi Guys

I have had to change our servers external and internal IPs. (We use NAT) We only have a handful of sites - 1 on a dedicated IP and 4 on a shared IP.

When I moved the first of the shared IP domains, cPanel decided that the IP was dedicated to that domain and now I can't migrate the rest of the sites to the shared IP because it no longer appears as being "available".

How do I tell cPanel that the IP is not dedicated that domain, so that I can give the other domains an IP address?
 

Michael Legg

Well-Known Member
Mar 2, 2015
67
4
58
New Farm, Queensland, Australi
cPanel Access Level
Website Owner
Does the Apache configuration also have the correct IP for the domains?
It looked a bit messed up, so I ran /usr/local/cpanel/scripts/rebuildhttpdconf and it looks correct now.

I think the problem is related to NAT.

There are 2 local IPs -
10.x.x.8 - Main Shared IP
10.x.x.7 - Dedicated to a single domain

When I enter their External IPs via the "Show or Delete Current IP Addresses", if I click "Validate", they both resolve to external IP of the Dedicated domain, it's like cPanel can't see the primary IP address. Yet, the public IPs are both resolving to the server.

If I run /usr/local/cpanel/scripts/build_cpnat it points both local IPs to the same external IP (The supposedly dedicated one)
10.x.x.8 -> xxx.xxx.xxx.1
10.x.x.7 -> xxx.xxx.xxx.1

When I test the 2 Public IPs ...
xxx.xxx.xxx.2 - (Main Shared IP) -> I get cPanel's "Sorry" page - /cgi-sys/defaultwebpage.cgi
xxx.xxx.xxx.1 - (Dedicated IP) -> I get the wrong site.

Also cPanel refuses to run when I try to license it to the main shared IP, so I had to change the license to the Dedicated IP to get it to work.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,496
1,009
313
cPanel Access Level
Root Administrator
The license server will be looking for requests over the main IP of the server that makes outbound requests. You can run this command to confirm what that IP address is on the system:

Code:
curl -w '\n' -s http://myip.cpanel.net/v1.0/
If that isn't the IP you want, you'd need to adjust the network settings in the operating system itself to change the order.

Running this:

Code:
cat /var/cpanel/cpnat
will show you how the NAT is currently configured. You can run:

Code:
/scripts/build_cpnat
to attempt to rebuild that NAT configuration.
 

Michael Legg

Well-Known Member
Mar 2, 2015
67
4
58
New Farm, Queensland, Australi
cPanel Access Level
Website Owner
cat /var/cpanel/cpnat

Gives the desired configuration, but that's only because I've entered it that way via the "Show or Delete Current IP Addresses" screen.

If I run /scripts/build_cpnat, it points both internal IPs to the same external IP - (the supposedly Dedicated one), it's like cPanel can't see the primary IP address. Yet, the public IPs are both resolving to the server.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,496
1,009
313
cPanel Access Level
Root Administrator
That sounds like the root of the issue - cPanel is only able to work with a 1:1 NAT configuration, meaning that each private IP address can only point to one public IP address. You'll want to speak with the host about that configuration to have them check things as cPanel doesn't set up that networking, but just reads it from the operating system.