Assign Multiple IP Addresses on One cPanel Account

WHM & cPanel's GUI only allows for one IP address to be assigned per cPanel account, however it is possible to assign sub-domains of a cPanel account their own IP addresses but for some reason this feature has not been built into the UI for general use. The only way to do this in fact is through SSH, so if you are looking to do this yourself then please bare in mind this is for advanced users only and following this guide is at your own risk!

  1. You will need to load up SSH and login to your server, once in you need to locate the file on the server for the sub-domain you wish to modify, the path is: /var/cpanel/userdata/$cpaneluser/$subdomain.$maindomain.$tld, replace each of the $ sections with the relevant data. TIP: if your unsure use the ls command to view whats in each folder.
  2. Edit the file in your favorite editor, I use NANO. Locate the IP section and change this to the IP you need for this domain, then save the file and close your editor.
  3. In the same location there will be a file with exactly the same name but with .cache as the extension, use RM to remove this file from the server.
  4. Now run the following command: /scripts/rebuildhttpdconf
  5. Edit the DNS zone for the sub-domain (which will likely be attached to the parent domain) and update the a-record to point to that IP as well. Then synchronize the zone out to the DNS cluster, if one exists: /scripts/dnscluster synczone <parentdomain>
  6. You will need to either edit: /etc/domainips (if the site was http) or: /etc/ssldomains (if the site was https) and change the ip in the file to the same ip you set above. If there is nothing in this file the format is:
  7. Now run the following command: /scripts/rebuildhttpdconf
  8. Now run /scripts/rebuildippool to assure the ip is marked as taken.
  9. Restart apache and the site should now respond to the IP address you assigned.
Author: Dean WilliamsI'm a Web Developer, Graphics Designer and Gamer, this is my personal site which provides PHP programming advice, hints and tips

Post Tags:
, , ,
0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments