DNS hierarchy and queries


The hierarchy of DNS servers starts with those in the nameless "root" domain. There are thirteen root name servers distributed around the world (why thirteen? It's the maximum number that will fit in a UDP DNS reply). Each of those name servers knows about the set of top-level domains and the name servers for each one.

Similarly, each set of top-level domain servers for a specific domain knows about the subdomains under it and the name servers for each one. This basically continues recursively for as deep as necessary. In each case if a higher-level domain wants to delegate local authority to a subdomain, it just lists a set of name servers for the subdomain, which have to be queried in turn to get information about subdomains of that subdomain. Woozy yet?

Clients typically issue queries to a specific DNS server with the rd "recursion desired" flag. The DNS server they query then has to try to figure out how to get information for that query, which may involve it making several queries on its own. Normally each DNS server is configured with the list of root DNS servers (they don't change much). It picks a root name server more or less at random and queries it for the rightmost domain component, getting a list of DNS servers authoritative for that top-level domain. It then queries one of those servers (picked at random) for the next rightmost component, and so on until a server can provide a non-NS record type for the full domain in question, which it can then return to the client. Conceivably the client could do all this itself, but often the ability to do full recursive queries is left to the DNS server.

This is partly why caching is so desirable in DNS; not having to send network queries each time a server wants to know who's authoritative for the com domain speeds up query response and reduces network traffic and server load.

Next ->


Steve VanDevender
Last modified: Mon Aug 1 22:49:10 PDT 2005