D. J. Bernstein
Internet publication

User's guide to name resolution

Resolution means conversion of a host name that you type, such as www.cnn.com, into an IP address, such as Internet computers actually contact each other using IP addresses; your browser needs to resolve www.cnn.com before it can contact www.cnn.com.

Most of the effort in name resolution is carried out by DNS caches such as dnscache. DNS clients (sometimes called stub resolvers), such as your browser, resolve names by contacting a nearby DNS cache.

This page explains the djbdns client-cache communication procedure. This procedure is followed by the dns_ip4, dns_ip4_qualify, dns_name4, dns_mx, and dns_txt library routines in djbdns, and by programs that use those routines.

Cache selection

The client finds the IP address of the DNS cache on a nameserver line in /etc/resolv.conf:
If /etc/resolv.conf does not exist or does not list any IP addresses, the client uses IP address in other words, it contacts a DNS cache on the same computer.

The system administrator can list several DNS caches in /etc/resolv.conf by including several nameserver lines. Servers after the 16th are ignored.

You can override /etc/resolv.conf by setting the $DNSCACHEIP environment variable. For example,

     env DNSCACHEIP= dnsip www.aol.com
will use IP address no matter what is listed in /etc/resolv.conf.


The client sends a request to the first DNS cache, waits 3 seconds for a response, sends the same request to the second DNS cache, waits 3 seconds for a response, etc. It then sends a request to each cache again, but waits 11 seconds for each response. It then tries each cache one last time, waiting 45 seconds.

Compatibility notes

Different DNS client programs use different procedures for contacting caches. Three differences between the djbdns procedure and other procedures: