Change IP address of a domain

You can change the IP address of a domain via WHM and from back-end.

Via WHM – Recommended

1. Log in to the WHM as root/reseller.

2. Move to Change Site’s IP Address under Account Functions.

 

whm

3. Select the domain and click Change.

4. In the window that follows, select the IP address to be used (from the drop-down menu) and click Change.

Via back-end – Not recommended

This method is to be used when you are getting an error when you try to change the IP address via WHM.

1. Login to the server as root.

ssh root@ipaddress -pport

2.Edit the VirtualHost entry for the domain with the new IP address in the apache configuration file.

vim /usr/local/apache/conf/httpd.conf

2. Change the IP address from WHM >> Main >> DNS functions >> Edit DNS Zone. (or edit the file /var/named/domain.com.db)

3. Also change instances of the old IP to the new IP in the following locations.

/var/cpanel/users/$user 
/var/cpanel/userdata/$user/$domain 

4. Run

/scripts/updateuserdomains 

4. Now rebuild the Apache configuration and restart apache.

/scripts/rebuildhttpdconf 
service httpd restart 

If you are changing the domain from a dedicated IP address, remove the IP address entry from the file /etc/domainips.

If the new change is not shown in WHM >> IP Functions >> Show IP Address Usage, change the IP address in /etc/userdatadomains. Also remove the symbolic link of FTP from/etc/pure-ftpd.

Please note that your site will be unavailable for 4-6 hours, if you change the IP address.