DNS Primer

The Domain Name System in a Nutshell

In the early days of the Internet, computers located and reached the few interconnected computers by referencing their unique numeric Internet Protocol (IP) addresses (e.g. 192.168.0.1). As the number of interconnected computers grew, the impracticality of memorizing all these numbers became obvious, and a rudimentary naming scheme was developed. A central repository of easy to remember names and their associated IP addresses was created and maintained in the form of a plain list in a text file named HOSTS.TXT. Periodically, administrators would connect to this central repository and download the current list of computer names. As the number of computers (hosts) on the Internet increased, this file began to grow exponentially and keeping the hosts file up-to-date became a much more daunting task.

Realizing that this system would prove to be difficult to scale, the host-naming process went "under the knife" in order to develop a more scalable system with distributed management. The Domain Name System was born. The designers proceeded to inscribe every detail of their creation and created the DNS Internet standards as defined by RFC 1034 and RFC 1035.

Implementation

DNS fulfilled its goal of becoming an efficient, distributed and scalable system for resolving human-readable hostnames to network-usable IP addresses. In fact, early DNS even included support for the now defunct CHAOS and Hesoid classes of addresses. The DNS hierarchy: a naming format in which the computer would be known by its name, followed by a hierarchical list of domains that were simply logical zones that the computer fell into for management purposes. These names are separated by dots and written in reverse order (broadest domain last). For example, a typical name looks like this:

www.neustar.biz


Since the domain name trees read from right to left, we can interpret that the broadest domain is ".BIZ". The ".BIZ" domain represents the portion of the name space that is set aside for businesses in 2001 to relieve some of the demand for .COM domain names. This portion of the name is known as the top-level domain or TLD. These top-level domains are authorized for use by Internet Corporation for Assigned Names and Numbers (ICANN) and are managed by individual entities called "Registries". "NEUSTAR" in WWW.NEUSTAR.BIZ represents the second-level domain name and is registered for use through any number of entities called "Registrars". The combination of the second-level and top-level domain is what is commonly referred to as the "domain name".

This leaves "WWW.", which is the hostname or the actual computer name as assigned by local administration. Furthermore, most administrators configure their DNS such that the domain without "WWW." will resolve to the same place as with the "WWW.".

While selecting a second-level domain name that directly represents your firm's name is a convention, there is generally no rule requiring it. For most top-level domains, anyone can register any name they choose, providing that the standard naming rules are adhered to and the name is available. Exceptions to this include sponsored top-level domains like .museum and .aero. Sponsored domains are reserved for members of a specific industry or location.

Resolution

Resolution is the process of translating a domain name into an address that computers can use. The easiest way to understand this process is with an example.

Let's imagine that an Internet user wants to look up information on a Web site. We'll use a fictitious site named "WWW.EXAMPLE.COM."

Typing the URL into the Web browser initiates the web request. Before anything else can happen, the user's computer must find for the IP address to determine the correct server for the URL.

The Web browser then turns this hostname over to the resolver. A resolver's sole purpose is to translate domain names to IP addresses. It's a silent computer program or process that runs on any computer connected to the Internet. The resolver starts by checking its own internal tables to see if it has any information stored or cached containing the IP address for the requested hostname. If not, the resolver checks its configuration for the IP address of a name server to which it can pass the query.

The server that the resolver connects to is known as the "recursive server". It is usually a DNS server that your connectivity provider maintains (corporate entities may maintain their own recursive DNS servers). The location of the server is not important, so long as the resolver can connect to it reliably and quickly.

Every registered domain name is required to select two (2) or more name servers that will pass on "official" data for that domain name to the rest of the Internet when asked. Domain owners designate the name server they wish to have answer authoritatively on their behalf. They must either maintain their own name server or coordinate with the administrators of an existing server to provide DNS services.

The recursive server, upon receiving a query from the resolver, checks to see if it is authoritative for the zone requested. If the recursive server can't resolve the query on its own, it too will need to take a "next step".

What servers can it ask and, how does it know about them?

All name servers that respond to queries have a file containing a listing of names and addresses of the Internet root servers. Their sole purpose is to get you started in the Authoritative Chain of DNS servers that will get the right answer.

In our example, the root servers don't know the IP Address for "WWW.EXAMPLE.COM" but it will recognize the ".COM" and point the recursive server to the next set of Authoritative servers that it should ask. Now, our query has made it from the client resolver to the recursive server to the root server, and the root server has found the server that should have the necessary information to respond to the query. The root server now passes this address back to the recursive server.

The recursive server contacts each authoritative server in the chain and issues the original query until it finds the answer. It will then return that result to the recursive server. The recursive server delivers the result to the client and potentially caches the query result. If a server is supposed to be authoritative for a domain but does not have any information for the domain or isn't configured to handle it, it causes a "lame delegation," where no queries are properly answered. Please note that some authoritative servers are setup to give a default answer if it doesn't have an exact match. This is called wildcarding and is described below.

The client resolver hands off the IP address in question to the actual network protocols to locate the IP address and establish a connection, and the resolution process is complete.

Although this process seems lengthy, it typically happens in milliseconds!

Expansion

Resource records are the foundation of DNS. Every piece of information that DNS can provide about a host or domain is stored as a resource record (RR), and dozens of different resource record types exist to help define the types of DNS information available. We'll take a look at a few common types.

Address A – See RFC 1035, sec. 3.4.1

Address A records are the "meat" of DNS. The A record stores the IP address associated with a given hostname. Most DNS operations are queries for A records.

A few things to note about A records:

  • An A record must always point to a single IP address. No other form of entry is acceptable.
  • Multiple A records can be entered with the same name (“label”). The DNS server will return all the IP addresses listed. Clients will generally try the first address listed, so order is important. Depending on implementation, this order can be round robin or selected based on topological proximity.
  • Multiple labels can be assigned the same IP address. In this case, querying any one of the labels will return the IP address.
  • It is possible to have an A record for a label that has the same name as your domain. For example, "gwlg.com" is a domain, but an A record can also be created to make "gwlg.com" resolve directly to an IP address.

Canonical Name (CNAME) – See RFC 1035, sec. 3.3.1

Canonical Names (CNAMEs) are the DNS equivalent of aliases or symbolic links. This record's function is to point a hostname to another hostname. For this to be useful, the "destination" hostname must have an A record which points to an IP address.

A few things to note about CNAMEs:

  • CNAMEs can point to any hostname on any domain anywhere in the world regardless of who owns the domain or where it is located.
  • CNAMEs require that both the destination host and the destination host's A record (IP address) be returned in order to properly resolve. As such, CNAMEs are generally slower than A records and should be used sparingly.
  • A domain name cannot be used as a CNAME label. For example: setting up "gwlgeeks.com" to resolve as a CNAME to "www.someprovider.net" will not work.
  • CNAMEs cannot point to URLs, nor can they point to specific directories on your Web server. A CNAME can only point to a hostname with a valid A record.

Pointer (PTR)See RFC 1035, sec. 3.3.12

Pointers are essentially the opposite of A records in that they resolve IP addresses back to hostnames. Although it is not a required function of DNS, some applications like to use an inverse query to authenticate or provide more information about a connected or connecting host.

A few things to note about PTRs:

  • Just like a domain name, a name server must be configured to be authoritative for the block of IP addresses, and the root servers must be aware of this delegation.
  • The smallest standard block that can be authoritatively delegated is currently 256 IP addresses (otherwise known as a "/24" or somewhat incorrectly as a "Class C"). There are proposed mechanisms to allow sub-delegation of PTR responsibility to even smaller blocks.
  • You do not have to set up PTRs for your hostnames and your domains to resolve correctly. Some applications may call for it, but it is not required by any Internet standard.

Start of Authority (SOA)

The SOA record defines the given name server's authority for the domain. In addition to authority, the SOA record contains several configuration parameters for the domain as follows:

  • Person In Charge - Email address of the person responsible for the domain's administration.
  • Serial Number - This number must be incremented each time a change is made to the records for a domain/zone. If a zone is changed but the serial number is not updated, the secondary server will not acquire the new data when it refreshes its zone information.
  • Refresh - How often, in seconds, a secondary name server is to check with the primary name server to see if an update is required.
  • Retry - If a secondary server tries to poll the primary server and fails, the secondary should wait this number of seconds before trying again.
  • Expire - If the secondary server is not able to update its data by contacting the primary server for this number of seconds, it will stop using the data it has for queries, in case the data is outdated or inaccurate.
  • Minimum TTL - TTL time is a per-record specification that tells any querying name server how long it should keep that particular record in its cache. The Minimum TTL field is a zone-wide default that is used when a record does not explicitly specify its own TTL time.

Name Server (NS)See RFC 1035, sec. 3.3.11

NS records supply the hostname of the authoritative name server(s) for the domain. Every domain must have an NS record and current RFC guidelines specify no fewer than two. Domains can also be divided into sub-domains as specified by local administrators and each sub-domain can have its own NS records.

Mail Exchanger (MX)

MX records specify the hostname of the server that will handle mail for the domain. When you send mail to postmaster@example.COM, your local mail server has to contact the server that handles mail for "example.COM" and pass the email on to it.

The server that handles mail for a domain could feasibly be any server on the Internet, so the host attempting to deliver mail needs a way to find out the address of the server to contact. This is the role of the MX record.

The MX record has three parts: a domain name, a hostname and a preference value. The domain name for the above example would be "example.COM". The hostname is the name of the server to which mail for this domain will be delivered. Incidentally, this server must also be configured to accept and handle mail for the given domain.

The preference value is a number (usually between 0 and 100) to indicate which MX record to try to use first if more than one exists. A lower number will always be used before a higher number. This allows for some redundancy if the preferred mail-handling host loses connectivity or the ability to accept mail for delivery.

A few caveats about MX records:

  • MX records are not equivalent to email addresses. They cannot contain a user name, only a hostname. The mail server for your domain handles "everything before the '@'" on its own.
  • MX records should never point to a CNAME record, only a host that has a valid A record.
  • MX records cannot point to an IP address.
  • The server you are pointing to will not begin handling mail for you until you let the server's administrator know and that administrator configures the server to accept email for your domain.

Wildcards

The character used as a wildcard in most DNS implementations is the asterisk (*). You may use this character in certain RRTypes to match any hostname beneath your domain.

If you set up an A record for "*.exampleexample.COM" to point to "127.0.0.1", every possible hostname will resolve to that IP address. So, with this entry in place, "www.exampleexample.COM" would resolve to "127.0.0.1", "mail.example.COM" will resolve to "127.0.0.1" and even "we.love.example.COM" will resolve to "127.0.0.1", all because of a single wildcard record that matches everything. You can configure an A record for "*." To point to "127.0.0.1" by itself so regardless of the query, it will always respond with 127.0.0.1

You can also do this for MX records. If mail is sent to somebody@example.COM, the MX record lookup for "example.COM" would be performed and that mail would be delivered to the host returned in the MX query. What would happen if mail was sent to "somebody@mail.example.COM", or "somebody@anything.example.COM"? The answer is that the mail will not be delivered, since an MX record for these hostnames does not exist. Rather than adding every possible hostname as an MX record, DNS allows you to specify "*.example.COM" as an MX record label, to catch all possible hosts.

Other Resources

DNS and BIND, published by O'Reilly.

For more information about DNS or the UltraDNS product line, visit our website at www.UltraDNS.com.

Back to Top

 

 

Ultra DNS - A NeuStar Service

Home | Careers | Contact Us | Demo | Log In