Adding internal ip address of main domains

Geo Grav

Member
Feb 7, 2016
8
0
1
Victorial, Australia
cPanel Access Level
Root Administrator
We have a NAT'ed cpanel server and we have been find that some web plugins will look up the address for the and obtain the external address. Requests to that address will not come back to the server.

We have been manually adding entries into the /etc/hosts file to over come this issue.

Does someone have a script that will do this automatically?

As very rough pseudocode:
whmapi1 listaccounts
for each non-suspended account, get the ip address via dns.
if returned address is external server address, add the host-name alongwith internal address to /etc/hosts

Oh, there probably needs to be a remove step there also.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,225
463
Hello,

I'll leave this thread open for user-feedback regarding discussion of the custom script, however I did want to make sure you were aware of the following document:

1:1 NAT - Version 68 Documentation - cPanel Documentation

Is the /var/cpanel/cpnat file already populated on this server?

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,225
463
We have been manually adding entries into the /etc/hosts file to over come this issue.

Does someone have a script that will do this automatically?

As very rough pseudocode:
whmapi1 listaccounts
for each non-suspended account, get the ip address via dns.
if returned address is external server address, add the host-name alongwith internal address to /etc/hosts

Oh, there probably needs to be a remove step there also.
Hello,

I'm not aware of any existing scripts that will perform those actions, however we provide a list of system admin services if you need help developing the custom script:

System Administration Services | cPanel Forums

Thank you.