2

When providing nameservers to my domain's registrar, i.e. nameserver 1 dns1.example.com nameserver 2 dns2.example.com nameserver 3 dns3.example.com nameserver 4 dns4.example.com

Do ISPs and computers always use the nameserver in order? i.e. where nameserver 1 is up it will be used, if not, nameserver 2 will be attempted to be used

Or can ISPs and computers use a different order?

cappuccino
  • 259
  • 1
  • 4
  • 9

2 Answers2

6

You can not guarantee and should not rely on the order used by DNS resolvers. DNS caching can make such predictions even more complicated.

the-wabbit
  • 40,737
  • 13
  • 111
  • 174
Khaled
  • 36,533
  • 8
  • 72
  • 99
  • @capuccino see also: http://en.wikipedia.org/wiki/Round-robin_DNS – the-wabbit Mar 03 '13 at 13:48
  • Thanks! Generally would the order be followed? All of my nameservers should be working, but as my nameserver 1 and 2 are from CloudFlare, I would want most of the traffic going through there for the CDN speed benefits. My nameserver 3, 4, 5, 6 and 7 are from Dyn and serve as redundancy in case CloudFlare's nameservers fail (which they have), but they do not benefit from CDN speeds. – cappuccino Mar 03 '13 at 13:53
  • 2
    @cappuccino Generally there will be no order. At all. Ever. It is even never supposed to be followed. – Sandman4 Mar 03 '13 at 14:58
4

In general, the order of the RRs as returned by the client resolver is undefined. Certain RR types allow for the specification of a precedence or priority - especially the MX and the SRV resource types.

If your implementation does not use one of these (and you asked for NS RRs which are unordered), you should consider all RR responses to be unordered as a conservative assumption.

This being said, most DNS server implementations would serve the RRs in the order you define them in the zone file unless you enable DNS-roundrobin. Caching resolvers may have roundrobin enabled but typically won't.

Client caches for IPv4 typically do not reorder all that much as well. With IPv6 things look different, though. RFC3484 Default Address Selection for IPv6 defines reordering in section 6 which is implemented at least in the Microsoft DNS Client.

What NS RR a DNS server recursing through to your zone is going to use in the end, is very much up to its implementation. Keep in mind that a (caching) DNS server would not rely on the operating system's implementation for resolving DNS queries but come with an own, likely including the ability to query multiple servers simultaneously and pick the fastest responding one for subsequent requests.

the-wabbit
  • 40,737
  • 13
  • 111
  • 174