Changing the Public IP in a NAT setup
- Written by Vanessa Vasile
- Published in Fixes, Howto, Networking
- Leave a reply
- Permalink
If your server is using a NAT setup and for some reason isn’t properly showing the correct public IP that should be mapped to the private IP on your server, you can easily fix this by creating a script to tell cPanel what the public IP should be. For example, you can simple put the IP address in plaintext in a file in the main document root of your server (usually /usr/local/apache/htdocs) or your website, then call it from /etc/cpsources.conf:
MYIP=http://locationofscript
When cPanel calls this script, the output of the script will be used to source the MYIP variable.
On a side note, if cPanel is not pulling your public IP properly, this could be an issue with your outbound routing between your server and router/firewall. Not having your server access the internet on the IP it was intended to respond to publicly could result in licensing issues with cPanel as well.