1
$\begingroup$

Suppose I type in the website www.youtube.com. The computer first asks a local domain name server (DNS) what the IP address of this website is. If it can't find it, it then asks the root server, etc. This is recursive querying.

How does DNS work if there is no recursive querying? Is the root server the only one that is used to find the IP address of the website?

$\endgroup$
2
$\begingroup$

If a resolver tries to send its recursive DNS queries to a server that refuses those queries, or the queries time out, then the resolver was originally supposed to try to do an iterative query itself: ask the roots, follow referrals until an error is detected or an answer is seen. However, nearly all resolvers are stub resolvers and simply choke at this point: they rely on being pointed to a short list of DNS servers where they can send recursive queries, and don't support doing iterative queries. Moreover, some networks only allow DNS queries to go to a small list of approved DNS servers providing recursive service. In this case iterative resolution wouldn't help.

(As Martin Berger points out, if the DNS server where a recursive query is sent happens to have the answer in its cache, and it is prepared to handle the recursive query, then it will supply the answer from its cache. Presumably your phrase "if there is no recursive querying" rules this out.)

The root servers answer recursive queries with referrals to other servers. This usually does not answer the query, and further queries are required.

If the DNS servers to which the resolver sends queries are not reachable, a DHCP lease refresh may provide a new list of servers and fix the problem.

A packet capture tool like Wireshark can show the DNS queries generated by your machine and the answers it receives.


For completeness, this is how the DNS works.

Usually the resolver is set up as a stub resolver, to send all DNS queries to a server. This is often done by including the IP address of this server in the DHCP negotiation when connecting to the network. The server's IP address can also be in /etc/resolv.conf or some equivalent configuration entry. When a DNS server sees a recursive query, and it is willing to provide an answer to that recursive query, then it usually does iterative resolution.

Iterative resolution works by sending the query to the servers for the root domain. This is a list of servers that changes infrequently; the latest one is available by FTP.

Queries to the servers for the root domain result in a referral, giving a list of name servers that are more likely to be able to answer. The resolver picks one of these, and sends the query there. This continues until it receives an answer, or something goes wrong: a loop occurs, a server responds with "NXDOMAIN" (no such entry exists in the DNS), or the query times out.

Name servers also keep a cache of previously seen name servers. When a DNS server is started, the first query works as above, but subsequent iterative queries will use the cache to short-circuit the process and will be sent directly to the best server, if one is known.

Instead of the term "recursive server", it is more correct to refer to a DNS server being prepared to answer recursive queries. Many DNS servers are prepared to answer recursive queries for some "trusted" clients but not for the Internet as a whole.

$\endgroup$
1
$\begingroup$

If there's no recursive query then the DNS query will succeed exactly when the local DNS server has an entry for the given fully qualified domain name (FQDN).

$\endgroup$
  • $\begingroup$ And the local DNS server receives an entry for the FQDN from the root server? $\endgroup$ – guest43434 Sep 19 '13 at 14:20
  • 1
    $\begingroup$ If I don't misunderstand this answer, then it is wrong. There are several types of DNS resolution, one of them being the recursive version where each server queries the one above him in the hierarchy up to the root servers; this way, every query is answered with either a resolution address or an error message that the domain could not be resolved. Another one is iterative resolution, where DNS server A may answer with a resolution, the address of another DNS server B lower in the hierarchy, or an error message. See here for example. $\endgroup$ – G. Bach Sep 19 '13 at 15:42
  • $\begingroup$ @G.Bach Maybe I misunderstood the question. I subsumed iterative queries under recursive queries. Maybe guest43434 can clarify? $\endgroup$ – Martin Berger Sep 19 '13 at 16:20
  • $\begingroup$ @guest43434 Don't hold all the worlds FQDN <-> IP mappings. $\endgroup$ – Martin Berger Sep 19 '13 at 16:22

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.