A domain name is often used in a Uniform Resource Locator
(URL) context. A URL normally has two parts:
• A service, like https:// and ftp://
• A domain name where the service can be reached
When a user types a URL, how is the domain name part of the URL translated to an IP address? An email address, likewise, consists of two parts:
• A mailbox or the recipient’s name
• A domain name where email can be delivered to the recipient The domain name must be translated to an IP address to reach the web page or send the email.
DNS servers resolve a domain name by finding the correct IP address, or some other information, represented by the domain name.
Figure 16-2 illustrates a web browser running on a host, trying to reach the service at www.example.com.
Figure 16-2 DNS Query from Host to Recursive DNS Server
When the user types www.example.com into the address bar on the web browser, the browser does not have an IP address to retrieve the files needed to build a website. The browser—an application running on a host—asks the network stack on the host operating system to resolve www.example.com into an IP address.
Note
Chapter 4, “Wired Host Networking Configuration, ” discusses how to view and configure the recursive
DNS server used by a host.
The host networking stack will build a DNS query and send it to a server. This first-level DNS server is often called
• A resolving server because it resolves DNS queries.
• A caching server because it caches the results of previous queries.
• A recursive server because it recurses through the domain
name, asking different servers to help resolve the domain
name.
Note
This book calls this first-level DNS server a recursive server.
The entire DNS database, a zone file, is too large for a single server to store and process every query efficiently. Because of this, different parts of the DNS database are broken up and stored on different servers throughout the Internet. Each server type has information about one part of the domain name—the TLD, the domain, and the subdomains.
How does the host know the recursive server’s address? The host learns the recursive server’s address through manual configuration or a protocol like the Dynamic Host Configuration Protocol (DHCP).
Note
Chapter 2 and Chapter 4 consider DHCP.
The recursive server begins at the far right on the domain name, the TLD. The recursive server needs to know where to find information about the domains within this TLD. The recursive server sends a query to one of the root servers to discover the address of the correct TLD server. The TLD server knows about every domain in the TLD. Figure 16-3 illustrates the recursive service querying of a root server to find out about the .com root server.
Figure 16-3 Querying a Root Server
How does the recursive server know where to send DNS query packets to a root server? There are only 13 root server addresses in the world. Each root instance is given a letter.
Instance A’s address is used in Figure 16-3.
The root server answers the recursive server’s query with an IP address where it can reach the TLD server for the correct domain—in this case, .com.
The recursive server will now ask the .com TLD server where to find out about domains within example.com. Figure 16-4 illustrates this query.
Figure 16-4 The TLD Query
The TLD server responds to the query with the IP address of an authoritative server. Note the recursive query only asked for information about .com in the first query to the root server, but it asks about example.com in the second query. As the recursive server discovers more information about the destination, it moves left to more specific information in the domain name.
Asking different servers for more specific information is the recursion process.
The recursive server queries the authoritative server asking for the full domain name. Figure 16-5 illustrates this final query.
Figure 16-5 The Authoritative Query
The authoritative server will, finally, give the recursive server an IP address for the service. Once the recursive server receives this information, it will
• Send a DNS response to the host so it knows to send IP packets to 2001:db8:3e8:e100::100 to reach the service at
• Cache the response to this query if other hosts ask for the same information.
Host operating systems also cache DNS responses. If another application on the same host (such as a different web browser) asks about this domain name, the operating system can provide information from the local cache.
How long will the host and recursive server hold on to the answer? Each DNS response contains a time to live (TTL), telling the recursive server and host how long the server thinks this response will be valid. Recursive servers and hosts can time out a cache entry more quickly than the TTL indicates, but they should never hold a DNS cache entry for longer than the TTL.