Add a subdomain that is hosted elsewhere [closed]

I am quite inexperienced with DNS, so this might be simple.

Our main domain foo.com is hosted at provider A. Now, we would like to host bar.foo.com at some other provider B - they have the domain set up with them, so I figure that I can do this by somehow adding the nameserver at provider B to the DNS configuration at provider A.

The current DNS config is as follows: http://imgur.com/kG099.png

How can I add the new subdomain to this configuration?

Note: maybe shared hosting provider is a more accurate term. Provider B is discountasp.net - I know their nameserver adresses, just not sure how to add them to my original setup.


If you own bar.com and have the DNS for bar.com housed on one server, you can delegate resolution for foo.bar.com to another DNS server if you like as such:

; zone bar.com
@ IN A 192.168.1.20
www IN A 192.168.1.20
foo IN NS ns1.other-dns-server.com.
foo IN NS ns2.other-dns-server.com.

Then, the other DNS server (at ns1/2.other-dns-server.com) can have an authoritative zone for foo.bar.com. Requests for foo.bar.com would be delegated to the other provider:

; zone foo.bar.com
@ IN A 192.168.1.50

With this setup, bar.com will resolve to 192.168.1.20, www.bar.com will resolve to 192.168.1.20 and foo.bar.com will resolve to 192.168.1.50.

Of course, I'm using non-routing IP addresses here for example purposes and you would replace them with whatever IP addresses were necessary.

Hopefully this answers your question, but if I've misunderstood what you're trying to do let me know in the comments.


What you are proposing won't work. You need to set up all the DNS entries on the same DNS servers, those that are authorative for the domain. That could be one at each hosting company but each needs to have matching entries because any DNS request could go to either one. So, while you could use both hosts it would be most inadvisable to do so, not least of which because it is far more work than it's worth to maintain.


What you want to accomplish can be done but your proposed direction for doing it is off track. Like John Gardeniers said the DNS records need to be the same ... both providers can host dns if they want but the records all need to match.

What you can do is setup the records so that the hosting for domain.com and/or x.domain.com is done at one place and y.domain.com is at another place. You need to understand the distinction between dns hosting and domain hosting however. Either place or both or your registrar or a third party can host dns. Dns is just a system of looking up names and matching them server addresses. Individual resources (in your case subdomains) can have their own unique records for where the hosting can be found.

Does that make sense conceptually? If the main domain is setup and working correction it should be as simple as adding another A record for your subdomain pointing the second provider that hosts it similar to this:

subdomain.domain.com. IN A 12.34.56.78

Obviously you will need the IP where the subdomain is hosted and the server at that IP will need to know how to handle requests when they come in with for that subdomain.