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) Once the above changes are made, you need to rebuild the Apache configuration for the changes to take affect in the respective VirtualHost entry
# /scripts/rebuildhttpconf

3) To mark the dedicated IP as “used”, edit the file /etc/domainips and enter the sub-domain entry
<dedicated ip>: subdomain.domain.tld Save the file and rebuild the IP pool
# /scripts/rebuildippool

4) Now, edit the DNS zone file of the main domain (i.e. the domain under which the subdomain is created)
# vi /var/named/domain.tld.db and set the A record of the sub-domain to point to the new IP. Save the file and restart the ‘named’ service
# service named restart

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.

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

Leave a Reply

Your email address will not be published. Required fields are marked *

Fork me on GitHub