Skip to main content

Server Main IP Change

Comments

8 comments

  • cPanelMichael
    Hello, You will need to change the IP address assigned to the accounts to ensure it's updated in the Apache configuration file and DNS zone. The following option is available for this purpose: "WHM Home " Multi Account Functions " Change Multiple Sites" IP Addresses" Or, you could also use the following feature: "WHM Home " IP Functions " IP Migration Wizard" Thank you.
    0
  • SB-Nick
    Assuming your network config in /etc/sysconfig/network-scripts is properly setup, have you updated your server IP under WHM > Basic cPanel & WHM Setup? There is also an utility in Home > Main > Account Functions >> Change Site's IP Address.
    0
  • Krydos
    I was under the impression that the basic setup option was which IP new accounts would be created on, rather than the server's main IP. Likewise I figured the IP migration tool was to move user accounts not the server's main IP. I guess I'll try it.
    0
  • Krydos
    Neither the IP Migration Wizard nor the Change A Site's IP Address page lists the server's main domain...
    0
  • cPanelMichael
    Hello, Could you clarify which IP address you are attempting to change? There's technically no "main domain" on a cPanel server. What's the specific entry in the Apache configuration file you are attempting to modify? Thank you.
    0
  • Krydos
    Ok, I know you all hate when people use actual IPs and actual host names, but here goes. Say my companies main website is example.com and all of our servers are named something like one.example.com and two.example.com, etc. Then our servers have user accounts on them like userdomain1.com and userdomain2.com. I'm trying to change the IP of one.example.com. I already have the DNS set up, and everything else is working, but I can't get the httpd.conf to update. Here's some obfuscated snippets of httpd.conf:
    PidFile /usr/local/apache/logs/httpd.pid LockFile /usr/local/apache/logs/accept.lock Listen 0.0.0.0:80 Listen [::]:80 User nobody Group nobody ExtendedStatus On ServerAdmin email@address.com ServerName one.example.com LogLevel warn ... ServerName userdomain1.com ServerAlias mail.userdomain1.com www.userdomain1.com DocumentRoot /home/user/public_html ServerAdmin webmaster@userdomain1.com UseCanonicalName Off ... # <---- THIS IS THE LINE I'M TRYING TO CHANGE ServerName one.example.com ServerAlias cpanel.* whm.* webmail.* webdisk.* cpcalendars.* cpcontacts.* DocumentRoot /usr/local/apache/htdocs ServerAdmin email@address.com ...
    The user accounts can and preferably should stay on 64.x.x.x, but I want the main server IP and the server name virtual host to change to 65.y.y.y
    0
  • cPanelMichael
    Hello, Do you see references to the old IP address in the user data files within the /var/cpanel/userdata/nobody/ directory? Thank you.
    0
  • Krydos
    Yes! That was what I was missing. For completeness of this thread, here is the process I took to change the main IP of a cpanel/whm server from 64.x.x.x to 65.y.y.y: --- WARNING! WARNING! WARNING! --- Messing up the IP settings on your server can leave your machine unable to connect to the internet thereby locking yourself out. Don't proceed unless you know what you're doing or you have a good backup plan to regain access in the case of a mistake. --- WARNING! WARNING! WARNING! --- Add the new IP at WHM >> IP Functions >> Add a New IP Address with the proper subnet mask. Edit /etc/sysconfig/network-scripts/ifcfg-eth0 and change the IPADDR= and the GATEWAY= lines to the new values. Edit /etc/ips and remove the new main IP 65.y.y.y and replace it with the old main IP in the format 64.x.x.x:: Edit /var/cpanel/mainip and replace the old IP 64.x.x.x with the new one 65.y.y.y Edit /etc/hosts and replace the old IP 64.x.x.x with the new one 65.y.y.y Restart the network service. On older init.d OS like CentOS 6 this is /sbin/service network restart or on newer systemd like CentOS 7 this is systemctl restart network.service You WILL lose your ssh connection at this point. If you did everything right you should be able to reconnect. Restart the ipaliases. On older init.d OS like CentOS this is /sbin/service ipaliases restart or on newer systemd like CentOS 7 this is systemctl restart ipaliases Go to WHM >> DNS Functions >> Edit DNS Zone Locate your server's main domain, and edit all 64.x.x.x to 65.y.y.y Log in to your cpanel account and update your license to the new IP address. If you don't do this your cpanel/whm will soon say it isn't licensed. Run /usr/local/cpanel/cpkeyclt to update the license to the new IP. OPTIONAL: Create your reverse DNS to the new IP address. This is beyond the scope of this guide, and only needed if you're going to send mail from this server's IP. That is where I got stuck, and with cPanelMichael's help I did the following: Rename /var/cpanel/userdata/nobody/64.x.x.x to 65.y.y.y and change all instances of the IP inside that file as well. Rename /var/cpanel/userdata/nobody/64.x.x.x.cache to 65.y.y.y.cache and change the IPs inside too. Edit /var/cpanel/userdata/nobody/main and main.cache to use the new IP. Then run /scripts/rebuildhttpdconf Then run /scripts/restartsrv_apache It all seems to be working now. Thanks everyone!
    0

Please sign in to leave a comment.