DNS and Hostnames

Trying to remember many IP addresses is nearly impossible for anyone, especially with the growth of the Internet during the past 10 years. Hostnames make everyone’s life easier by giving an IP address a memorable name. After all, remembering microsoft.com is much easier than remembering 207.46.130.149.

Originally, in the dark days of the Internet and TCP/IP, hostname resolution was left to a single text file, called the HOSTS file. Hostnames were manually added to this file, and then the file was downloaded and distributed to each TCP/IP host. HOSTS files work fine and are manageable if your network is small. HOSTS files in Windows NT and Windows 2000 are stored in the %systemroot%\SYSTEM32\DRIVERS\ETC directory. Example 1.1 shows a sample HOSTS file.

Example 1-1. Sample HOSTS File

# Copyright (c) 1994 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Chicago
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1          localhost
192.168.0.l        cg141484-a
192.168.0.254      proxy
192.168.0.2        nalcott

The HOSTS file method of hostname resolution became more cumbersome and inefficient as the Internet grew. In 1984, two new RFCs (882 and 883) were released detailing DNS. These RFCs have since been superceded by RFCs 1034 and 1035.

DNS is a distributed database that allows local administrators to maintain their portion of the DNS database while allowing access to it for hostname resolution across the entire Internet. DNS is implemented in a client/server arrangement. The server portion is driven by name servers. Name servers hold the segment of the DNS database (called a zone) that they have authority over. The client portion is known as a resolver. This can be any TCP/IP client that supports DNS. Whenever you are using the Internet, whether it is the World Wide Web or simply email, you are using DNS.

The structure of the DNS database can be described as an inverted tree (see Figure 1.16). The top of the tree (or the trunk) is known as the root domain. It is shown as a single dot (“.”).

Below the root domain are the top-level subdomains. Currently these include com, edu, net, org, mil and country domains, such as jp for Japan and nz for New Zealand. In 1998, the United States government turned Internet addressing and naming duties over to a private organization called the Internet Corporation for Assigned Names and Numbers (ICANN). ICANN is currently developing a new standard for top-level subdomain naming. This will expand the top-level domains into more recognizable domain names. These new top-level domains are biz (for corporations), info (for informational use), name (for people’s names), pro (for professionals, such as doctors and lawyers), museum (for museums and nonprofit organizations), aero (for airlines), and coop (for cooperatives). This new domain naming standard will blur the line between the original top-level subdomains com, net, and org.

Subdomains are DNS management structures. The local administrators for those domains are responsible for maintaining that portion of the DNS database. These subdomains can also be broken into further subdomains, which can be delegated authority as well.

Example DNS structure

Figure 1-16. Example DNS structure

An absolute hostname in DNS is called the Fully Qualified Domain Name or FQDN. An FQDN begins with the hostname and proceeds to the root. For example, www.microsoft.com describes a host with the name www in the subdomain microsoft under the com top-level domain. Although you can also include the final “.” for the root domain, it is typically left out and is not necessary.

As mentioned earlier, name servers have authority over one or more zones (see Figure 1.17). Zones are simply a subset of the DNS database. Please note that zones do not have to have any normal boundaries. A zone may contain a single domain, two subdomains, or multiple levels of the name space.

DNS zones and delegation of authority

Figure 1-17. DNS zones and delegation of authority

Each zone must be serviced by a primary name server. The data for the zone is housed on the primary name server in files. To provide some redundancy for name servers, there is also a secondary name server. Secondary name servers update their files by periodically doing a zone transfer, a mechanism for replicating changes on the primary name server to secondary name servers.

DNS Name Resolution

When an application such as a web browser needs to resolve a hostname, it uses the client portion of DNS, known as a resolver. The resolver creates a DNS query specifying the hostname to be resolved and sends the query to a name server it was configured to use. The name server then queries the root domain’s name server, which responds with the address of the appropriate top-level domain’s name server. This continues until the request reaches the name server that can satisfy the query (see Figure 1.18).

DNS name query process

Figure 1-18. DNS name query process

Although it looks like it would take a long time for resolution to take place, in reality it’s mostly a matter of seconds for the request to be resolved. Some of this speed can be attributed to the fact that name servers will cache results of queries. So the next time you type a web site’s address into the address bar of your browser, count how long it takes to resolve.

Get DHCP for Windows 2000 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.