At times there might be possibility that you would like to host Sub Domain eg. subdomain.yourdomain.com at different server than your current server where you have hosted your main domain eg. yourdomain.com.
Lets assume you would like to host a Forum which is quite resource intensive script and thus requires to have it hosted at either different hosting account or a VPS.
So you have your main domain “yourdomain.com” hosted at Server 1 and you would like to host forum “forum.yourdomain.com” subdomain at Server 2
This can be achieved easily by following below steps. For better understanding we will use below names.
yourdomain.com – Primary Domain
forum.yourdomain.com – Sub Domain
Log in to your Primary Domain’s Hosting Account, Edit DNS Zone of your Primary Domain and Add an ‘A’ entry for the Sub Domain pointing to Server2 Main IP Address.
You need to find your 2nd Server’s Main IP Address which can be easily done by pinging any existing domain hosted at Server2.
To ping existing domain hosted at Server 2 you can use this command from Command Prompt
“ping your2nddomain.com” which will expose the Server IP Address.
If you find it difficult to run ping command then you can simply head over to the website Whatsmydns.net , enter any another domain hosted at 2nd Server, Select A from drop down list and hit search, you will get your 2nd Server IP Address, note it down.
If you still find it difficult then you can simple ask your Hosting Provider to provide you a Server’s Main IP Address.
Example of an entry to be added.
forum.yourdomain.com – A – 14400(TTL Value) – xx.xx.xx.xx (2nd Server Main IP Address)
Before hosting Sub Domain, we need to make sure that the new entry is properly added in DNS Zone and to verify that we can use website Whatsmydns.net Enter your subdomain, Select A from the drop down list and hit search to see the IP Address which is resolving for your Sub Domain.
If its same as your 2nd Server Main IP Address, Bingo you have successfully added DNS Entry for Sub Domain
Now head over to your 2nd Server and log in to WHM / Cpanel, if you would like to host this Sub Domain as stand alone account then you can use WHM – > Create Account function or if you would like to add it as Add On Domain then you can go to Cpanel – > Add on Domain to host this subdomain.
In both the cases simply enter your complete Sub Domain eg. forum.yourdomain.com and fill out rest of the info, once done you can hit the Create button.
Depending upon propagation time, once done you can see that your Sub Domain is successfully hosted at 2nd Server. To verify that you can simply create a test html file in Document Root of your Sub Domain eg. public_html following Cpanel – > File Manager and by browsing relative path of file eg. forum.yourdomain.com/test.html from your favorite browser.