Changing WHM Server IP with NAT Enabled

Aaron Hatton

Active Member
Jun 19, 2012
London, United Kingdom
cPanel Access Level
Root Administrator
I just had an issue with regards to the change of our WHM servers IP address, as this server is using NAT and the server is configured for a private IP as opposed to a public it was throwing up errors when attempting to access basic server configuration etc.

I did a lot of research to try and fix the issue however could not find a straight forward answer so am posting this to help someone else out should they have an issue.

The Steps

I initially followed this guide: How to change the primary IP address of a WHM/cPanel server which was useful in regards to getting access to the server once again however the next challenge I faced was the errors when accessing the Basic cPanel & WHM Setup page within WHM and any IP Functions

I found the following NAT Documentation provided by cPanel: NAT Documentation which advised of a file called "/var/cpanel/cpnat" which I needed to edit, I did this and restarted the server but to no avail.

Further down the page is mention of a NAT Build script, I thought it was a long shot but gave it a go regardless and ran the command "/scripts/build_cpnat" (Nothing is ever this simple!)

To my surprise this got it working straight away, a quick change of the configuration within the Basic cPanel & WHM Setup for the section "The IP address (only one address) that will be used for setting up shared IP virtual hosts." to the new IP and it is done!


It does seam on this occasion things can sometimes be simple if you find the correct article, it would be good to see if anyone else had this experience and if I did one too many steps in order to fix this or if I am missing some which will cause issues at a later date.

It was however a good challenge and one I now know what to do for next time, I hope this helps save someone else the panic I had...


Staff member
Apr 11, 2011

I am happy to see the issue is now resolved. However, do keep in mind that per our documentation, we strongly recommend that you only perform these actions on a fresh installation of cPanel & WHM. Do not attempt a 1:1 NAT configuration on an existing production server.

Thank you.