centoscpanelgoogle-compute-enginecentos6

How to fix local IP in Nat Configuration on WHM/Cpanel on Centos 6 on Google Compute Engine


If you deleted a VM on Google Compute Engine on a Centos 6 Cpanel server and then create it with the same disk, you often are assigned a new local IP address even if you kept the static IP. This does not properly update in the NAT configuration on Cpanel/WHM servers.

This stops any sites from working and the only way to fix it is manually edit the http.conf file. Inside Web Host Manager you can fix the public facing IP, but there is no place to edit the local IP. Does anyone know how to edit the nat configuration on centos 6 on Google Compute Engine to fix the local IP so that all new sites created will have the correct local IP in the http.conf?

Here is a pic of the current nat configuration on my Centos 6 server. enter image description here

Here is a pic showing my correct local IP in Compute Engine, you can see it does not match the one Cpanel has, which causes the http.conf file to generate new virtual hosts with the wrong IP. enter image description here


Solution

  • Its a configuration issue within WHM/Cpanel that can not be corrected with any configuration settings in the interfaces. I contacted Cpanel Support and they provided me with a command line shell script to run from root to fix the issue. It worked flawlessly:

    # /scripts/build_cpnat
    

    This resolved the issue, but they gave this additional info if that does not solve your problem:

    If this does not resolve your issue, please review our NAT documentation and ensure that your server is configured in a supported 1:1 NAT configuration: http://documentation.cpanel.net/display/ALD/1%3A1+NAT