The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to reconfigure existing cPanel installation to use NAT ?

Discussion in 'General Discussion' started by onesixright, Apr 24, 2014.

  1. onesixright

    onesixright Member

    Joined:
    Apr 24, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi All,

    I did try to find within cpanel forum and google for a solution, but nothing satisfactory i found. Lots of old posts about the pre 11.40 version.

    We are running cPanel for a while, which was running fine. Yesterday we needed to resize the root partition on our AWS-EC2 instance. After rebooting we got a new internal IP (10.x.x.x). Because the IP changed, all websites went to default web page (i'm sure this something familiar). I quickly fixed the 'default page' problem by replacing the old ip address with the new one in /etc/httpd/conf/httpd.conf. So for the moment it works, but i know you should not make changes to this file directly.

    Since 11.40 there is NAT support, however we installed our server before 11.40.

    I want to use the NAT functionality (currently we run WHM 11.42.1 (build 12)).

    I Tried:
    • /scripts/build_cpnat
    • /scripts/rebuildhttpdconf

    The NAT is shown correctly on the 'Show or Delete Current IP Addresses'. But when I restart httpd, i'm back to the default pages for all websites :mad:

    Then there are a bunch of files that still have the old 10.x.x.x IP.

    So my question is whats the correct way to reconfigure a existing cPanel installation to use NAT?

    There also a bunch of files that still contains the old IP (10.x.x.x)

    • /etc/*
    • /var/cpanel/userdata/*/*


    Do i need to replace the old ip in all these files by hand? Or is there a script that can fix this?

    Many thanks!
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    651
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Please review the contents of:

    /var/cpanel/cpnat

    Per our documentation:

    The list of the public IPs that are associated with the internal IPs will be written to the /var/cpanel/cpnat file one mapping per line: local_ip remote_ip

    Also, are the accounts assigned the old IP addresses in Web Host Manager?

    Thank you.
     
  3. onesixright

    onesixright Member

    Joined:
    Apr 24, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    it has one line:

    10.246.xx.xx 54.x.x.x

    I'm not sure what you mean? Where would you like exactly to look?
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    651
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    For instance, when you browse to "WHM Home » Account Information » List Accounts", are the accounts assigned the correct IP address?

    Thank you.
     
  5. onesixright

    onesixright Member

    Joined:
    Apr 24, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Ah, ok. Well the problem is i see both.But i did edit the httpd.conf and did a global find and replace on the old 10.x with the new 10.x IP.

    99% having the local 10.37.xx.xx IP, just a few have the external IP (EC2 elastic IP). BUt those i updated with the 'change site ip' function.
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    651
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    It's better to change the IP addresses via:

    "WHM Home » Multi Account Functions » Change Multiple Sites’ IP Addresses"

    Rebuilding the Apache configuration file via /scripts/rebuildhttpdconf should revert the changes unless you used the distiller.

    Thank you.
     
  7. onesixright

    onesixright Member

    Joined:
    Apr 24, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    But, in that screen it already show the external IP address (54.x.x.x). If i select a domain it tells me 'domain.tld is already using ip 54.x.x.x'. Where in account list it shows the 10.x.x.x IP's :confused:
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    651
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  9. onesixright

    onesixright Member

    Joined:
    Apr 24, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    ok, i now run /scripts/rebuildhttpdconf .

    Now i see on 'Change Multiple Sites’ IP Addresses' all domains are set to the elastic IP address (54.x.x.x).
    On the 'list accounts' i see the OLD 10.37.xx.xx IP's which should be 10.246.xx.xx?

    If I grep 10.246.xx.xx from /etc/httpd/conf/httpd (date time is changed) i see all websites be set to 10.246.xx.xx (thats the new IP, which looks good).
     
  10. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    651
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Feel free to open a support ticket using the link in my signature so we can take a closer look. You can post the ticket number here so we can update this thread with the outcome.

    Thank you.
     
  11. onesixright

    onesixright Member

    Joined:
    Apr 24, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    @cPanelMichael, it seems to be solved. Al files look good after the rebuildhttpdconf, thanks!
     
  12. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    651
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page