How to assign a dedicated IP to a Sub-domain OR Add-on/Park domain?

By default, cPanel allows one IP per account, however, in case you wish to assign multiple IPs to an account, say for a sub-domain, you can do so by editing a few files. Follow the below steps:

1) The main configuration file of a domain is stored under the /var/cpanel/userdata/<username>/ directory, so edit the subdomain related file under it

# vi /var/cpanel/userdata/<username>/subdomain.domain.tld

Change the value of “IP” to a dedicated IP and save the file. The add-on and Park domains have their related subdomain files in the same directory.

2) Now, rebuild the Apache configuration for the changes to take affect in the respective VirtualHost entry

# /scripts/rebuildhttpdconf 

3) Restart the Apache webserver

# service httpd restart

4) Add the dedicated IP and sub-domain in the /etc/domainips file to mark the dedicated IP as assigned so WHM won’t be able to assign it to other domains.

dedicatedIP: subdomain.domain.tld

Save the file and rebuild the IP pool

# /scripts/rebuildippool

5) Now, edit the DNS zone file of the main domain (i.e. the domain under which the sub-domain is created) and add an ‘A’ record for the sub-domain to point to the new IP.

# vi /var/named/domain.tld.db

Save the file and restart the ‘named’ service

# service named restart

Allow sometime for the new IP to propagate.

Note: Rebuilding the IP pool will still list the IP as free under the WHM -> IP Function -> ‘Show IP Address Usage’, however WHM wont allow you to assign that IP to another domain.

This entry was posted on Tuesday, March 8th, 2011 and is filed under cPanel Management. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.