I own a domain econemon.com. Below is an excerpt from the DNS entry (some records omitted for brevity):

econemon.com.       1800    IN  NS  ns.stratoserver.net.
econemon.com.       1800    IN  NS  ns2.stratoserver.net.
econemon.com.       1800    IN  A

These nameservers there are those from my provider, and as far as I understood it, they are the authorative ones for my domain.

Now, when I go ask one of them for the address record of a nonexistent subdomain, it responds with the address for my server, like so:

$ host -t A nosuchdomain.econemon.com ns.stratoserver.net
Using domain server:
Name: ns.stratoserver.net

nosuchdomain.econemon.com has address

Which is, of course, exactly what I want in order to have virtual hosts etc. Now, say I added an entry

econemon.com.    IN  NS  ns.econemon.com

and the proper A record for ns.econemon.com to the list, and that nameserver actually had different A records for some subdomains, what would happen?

  • would a request for subdomain.econemon.com yield a different address depending on which name server you asked? (I guess it would.)
  • if so, this might actually be useful to fall back to a "main server" if my DNS was down, but how do I make the client to use my name server when it's up?
  • would this mess up caching on the clients? (Probably.)

(Note: This is related to my other two questions)

  • "nosuchdomain.econemon.com has address". As there is no such domain, I would instead expect "Host nosuchdomain.econemon.com not found: 3(NXDOMAIN)". – Abdull Nov 23 '15 at 16:17

DNS lookups are sequential, starting at the end. Assuming empty caches, the lookup for MISSING.DOMAIN.COM would go something like this ...

  • the DNS client would request MISSING.DOMAIN.COM from a DNS server.
  • the DNS server asks the "root" DNS for MISSING.DOMAIN.COM domain, and gets back a name server for the COM domain.
  • the DNS server asks the COM name server for MISSING.DOMAIN.COM, and gets back a name server for the DOMAIN.COM domain.
  • the DNS server asks the DOMAIN.COM name server for MISSING.DOMAIN.COM. The DOMAIN.COM name server has no answer, so it reports back an address for DOMAIN.COM, depending on it's configuration.
  • If there were an NS record for MISSING.DOMAIN.COM, it would be returned, and the original DNS server would query it next. If there was an A record for MISSING, the IP on it would be reported back.

That is the gist of it. In reality it is far more complicated due to caching, load balancing, and the fact that Name Servers can be specified by name and so must be looked up as well.

To summarize your question .. you can specify several name servers for a domain and have them setup with different information. The answer is yes, but you must be careful and know what you are doing. You can use DNS to support load balancing and can use it to support failover lite. But you need to be careful!

EDIT: in a comment, bortzmeyer pointed out a couple of simplifications which in his opinion cross the line to error. I made adjustments that I hope address the concerns.

  • 1
    Wrong explanation. In the second step, the server does NOT "asks the root DNS for the COM domain", it just transmits the same question, verbatim (here, MISSING.DOMAIN.COM). Same thing for the steps after. That's why managing a root or TLD name server is a great way to spy the users :-) Also, when the DNS server authoritative for DOMAIN.COM replies, it does not always send "it's default host address", it depends if there are wildcards or not. – bortzmeyer Jun 19 '09 at 11:56

This is one of those "I don't think that word means what you think it means" situations. You're calling host records within a given domain "subdomains". They're not.

To answer your bullet-point questions all together:

A request to a given name server will return what it thinks the appropriate answer is. It sounds like you're suggesting that you could add another DNS server as authoritative for your "econemon.com" domain that would have some "A" records in it that the others would not. That is not a common or recommended configuration of DNS. You generally want all the DNS servers authoritative for a given domain to have the same records (unless you know why you're doing that... aka "split-horizon" DNS.)

There's no generally useful reason for doing what you describe. You cannot influence the client computer resolver's choice of DNS server. It wouldn't "mess up" caching-- the caching would work like it's supposed to. It would create inconsistent results depending on which DNS server a client talked to, and that's generally bad.

A subdomain would be something like a "subdomain.example.com" domain that contained host records like "www.subdomain.example.com". What you're talking about are just hosts in a domain.

  • OK, thanks for clarifying that. So I'd put several host records, i. e. A records for the names example.com, www.example.com, ftp.example.com in a zone file that can then live on either my server or the provider's, or both? And what happens then with doesntexist.example.com, how's that resolved? – Hanno Fietz Jun 17 '09 at 16:25
  • +1 for Princess Bride reference ;) – Russell Heilling Jun 17 '09 at 16:27
  • Host records are subdomains. Every domain name but "." (the root) is a subdomain. – bortzmeyer Jun 19 '09 at 11:56

It looks like you have a DNS Wildcard record for your domain.

*.econemon.com.  IN A

This means that if a query results in no records, you'll get an A record for Actually it is more complicated than that. If there is ANY record for a "label" (a fully qualified domain name, or FQDN) then that disables the wildcard record for that label. So, if you have an MX record for foo.econemon.com., a query for foo.econemon.com's A record will turn up nothing.

Wildcard records are somewhat rare and can confuse certain software systems. I don't recommend using them. However, your ISP is using them so that you don't have to bother them to update DNS records every time you add a subdomain. That makes sense.

Now on to your question...

What it seems like you are asking is, "If I have one nameserver with different data than the others, what will happen?"

Well, if you have 2 that your ISP runs with certain data, and 1 that you run with different data, then there is a 2:1 chance of getting data from your ISPs server. The DNS system doesn't keep looking to other nameservers if it doesn't find the data it wants in the first one. In other words, you can't ask Daddy if Mommy said "no".

This is an important concept in DNS. DNS needs to be FAST. Therefore, never do 2 queries when 1 will do.

That's why you should have the same exact zone data for a domain in each of the domain's nameservers. (Unless you have some funny load balancing scheme.)

  • would a request for subdomain.econemon.com yield a different address depending on which name server you asked? (I guess it would.)


  • if so, this might actually be useful to fall back to a "main server" if my DNS was down, but how do I make the client to use my name server when it's up?

The nameservers are tried in random order. If the first one doesn't respond, the DNS client will try the next one. When all have been tried the client gets a DNS error. Since each DNS server it sent 1 query, but generally we wait 30 seconds (I think) for a reply, if you have 100 nameservers, you'll be waiting 50 minutes before the client errors out. That's why I don't usually have more than 3 nameservers for a domain. More isn't better.

  • would this mess up caching on the clients? (Probably.)

Not really. The software is very robust. Postel's robustness principle ("be conservative in what you send, liberal in what you accept") comes into play here. It has benefits. Do queries for www.yahoo.com, www.microsoft.com and www.google.com. You'll see that each nameserver gives different IP addresses depending on where you are in the world (and other factors). If that were to confuse clients, those sites wouldn't survive!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.