This walkthrough is for changing the IP of a domain/account to one that is already taken by another account. If you’re simply changing the site’s IP to one that is free, use the WHM > Change Site’s IP Address function instead.
Update: To set up multiple shared IP addresses, please see this post.
Change the DNS
You can edit the DNS zone in WHM > Edit DNS Zone, or edit /var/named/yourdomain.com.db directly to point the domain to the desired IP on the server. Make sure to increment the serial number, then run /scripts/dnscluster synczone yourdomain.com to sync it up to your nameservers. If you’re using external DNS, you’ll obviously need to point the domain in those nameservers instead.
Edit the cPanel Files
You need to change instances of the old IP to the new IP in the following locations, replacing $user with the username of the account, and $domain with the domain you are changing the IP for.
/var/cpanel/users/$user
/var/cpanel/userdata/$user/$domain
Now, add the IP to /etc/domainips in the same format as the others:
xxx.xxx.xxx.xxx: $domain
Build the Configs
Now rebuild the Apache config:
/scripts/rebuildhttpdconf
service httpd restartThat site should now be using the IP you specified. Keep in mind that if your ISP is caching the old IP, your default server page will show up instead of your website, until the IP change is propagated. This can take 4-24 hours.
*This technique is also used to assign multiple IPs to addon domains of a cPanel account. Follow the same procedure, only edit the config files for the domains you are changing.
No comments:
Post a Comment