root of the tree is a domain named . (similar to the /
root directory in a file system).
Each of the resource records belonging to a domain stores a different type of information. For example:
> A (Address) records store the IP address associated with a name.
> NS (Nameserver) records name an authoritative nameserver for a domain.
> SOA (Start of Authority) records contain basic properties of the domain and the domain's zone.
> PTR (Pointer) records contain the real name of the host to which the IP belongs.
> MX (Mail Exchanger) records specify a mail server for the zone.
Each record type is discussed in detail later in this chapter.
Every node has a unique name that specifies its position in the tree, just as every file has a unique path that leads from the root directory to that file. That is, in the domain name, one starts with the root domain (.
) and prepends to it each name in the path, using a dot to separate the names. The root domain has children named com.
, org.
, net.
, de.
, and so on. They, in turn, have children named ibm.com.
, wiw.org.
, and gmx.de.
.
In general, a
foo.example.com.
This is similar to the following path:
/com/example/foo
Contrary to the example, the trailing dot in an FQDN is often omitted. This reverse order is the source of confusion to many people who first examine DNS.
How Nameservers Store DNS Structure Information
Information about the structure of the tree and its associated resource records is stored by programs called
The authoritative nameserver for a zone knows about the nameservers to which authority over subdomains has been delegated. The authoritative nameserver might refer queries about the delegated zones to those nameservers. So you can always find authoritative data for a domain by following the chain of delegations of authority from . (the root domain) until you reach an authoritative nameserver for the domain. This is what gives DNS its distributed tree structure.
How DNS Provides Name Service Information to Users
Users of DNS need not be aware of these details. To them, the namespace is just a single tree — any part of which they can request information about. The task of finding the requested RRs from the resource set for a domain is left to programs called
As an analogy, you can think of domains as directories in a file system and RRs as files in these directories. The delegation of authority over subdomains is similar to having an NFS file system mounted under a subdirectory: Requests for files under that directory would go to the NFS server, rather than this file system. The resolver's job is to start from the root directory and walk down the directory tree (following mount points) until it reaches the directory that contains the files in which the user is interested. For efficiency, the nameservers can then cache the information they find for some time. This is why things appear to be listed in reverse order. This process is examined in detail next.
In practice, there are several authoritative nameservers for a domain. One of them is the
As a DNS administrator, it is your responsibility to ensure that your nameservers provide sufficient redundancy for your zones. Your slaves should be far away from the master so that power failures, network outages, and other catastrophes do not affect your name service.
Despite these precautions, the load on DNS servers would be crushing without the extensive use of local caches. As mentioned before, nameservers are allowed to cache the results of queries and intermediate referrals for some time so that they can serve repeated requests for data without referring to the source each time. If they did not do this, root nameservers (and the nameservers for other popular zones) would be contacted by clients all over the world for every name lookup, wasting enormous resources.
Name Resolution in Practice
When a web browser issues a request for an IP address, the request is sent to a local name- server, which resolves the name, stores the result in its cache, and returns the IP address. DNS can be a fascinating and extremely in-depth subject — see the 'Reference' section at the end of this chapter for further reading.
Using DNS Tools
Fedora includes a number of standard tools that enable you to work with DNS. These tools, found in the bind-utils
and whois
packages, have everyday uses that do not require DNS administrator skills. If you want to know what domain name belongs to an IP address, or vice versa, these are the tools to use to track down that information. Forward lookups are where you map a name to an IP address; reverse lookups are where you map an address to a name.
Here are tools you can use:
> dig
(
> host