Lecture 11: Domain Name System


Naming in Computer Networks

In the beginning, people who used computers had to make do with simple numeric identifiers to identify parts of a system. It (very quickly) became apparent that humans do not use such naming schemes well - they make mistakes, and they work inefficiently. This was a problem.

The solution is to allow computer users to describe entities using symbolic names instead of numbers. That is, you can refer to something by name. You could say this was the earliest development in "Human-Computer Interfaces".

In this subject, we are mostly interested in the names that people use for computers in a network. For example, at Bendigo we (in the IT department) have followed a long tradition of naming our computers after local flora. Thus we have ironbark, redgum, greybox, etc, not to mention bindi, poa, capeweed and lots more.

Each of these computers can also be identified by its numeric IP address. However, it is much more convenient for us to use its name, and let software perform the mapping to IP addresses when needed.

Such mappings are carried out by a directory service, and in the case of mapping machine names to IP addresses, the directory service is the Domain Name System (DNS).


Name Spaces

When the Internet was first being developed, each connected computer simply had a name. If you wanted to connect a new machine, you submitted a name for approval. If it was OK, you connected, and everyone else updated their hosts.txt file, used to map names to addresses, to include the new name. This is called a flat name space and works fine when everything is nice and small. It has one big problem...

It doesn't scale.
The solution is to adopt a scheme used naturally by humans in all sorts of fields of endeavour: the hierarchical structure.

Hierarchies have been used since forever to manage complex structures: businesses, armies, bureaucracies, street addresses and computer filesystems. They are one thing that seems to come completely naturally to us.

In the Internet, we say that we allocate names from a hierarchical name space.

In such a system, a name only has to be unique within a local context, or group of names, a context (or domain) name only has to be unique among other domain names at the same level in the hierarchy, etc.


The Domain Name System

The DNS is the major directory service in the TCP/IP-based Internet. Historical notes: Some top level DNS domains include:
edu
educational institutions
com
commercial organisations
mil
U.S. military agencies
org
"other" organisations
au
top level domain for Australia, similarly (eg) uk (United Kingdom), ca (Canada), etc. -- these were not originally thought necessary, but...


DNS Names

DNS namespace
Rules:
  1. A name is a dotted sequence describing a path through the name hierarchy from the root, maybe with a trailing dot, thus:
    bindi.bendigo.latrobe.edu.au.
    
  2. An individual name component must be less than 63 characters, must begin with a letter, etc...
  3. Upper and lowercase may be used, although name lookups are case insensitive by definition.


Resource Records

Each domain name has one or more resource records associated with it. Resource records are 5-tuples:
Domain_name  TTL  Type  Class  Value
Domain_name
the name of the domain to which this RR applies.

TTL
the Time To Live of this RR. When this RR is returned as a result of a DNS lookup, the remote host normally caches the information for efficiency. The TTL is the time, in seconds, after which the cached information should be regarded as potentially out of date.

Type
there are several types of RR, including:
SOA
Start Of Authority.
A
IP address of a host.
NS
Name Server, etc

Class
Always set to "IN", for Internet

Value
The actual value of this particular RR. Can be, for example, an IP address, a number, some ASCII text or a combination.


DNS Servers and Resolvers

A server provides name-to-address mappings for one or more zones, which are sub-trees of the domain name space. For example, sheoak is a name server for the zone bendigo.latrobe.edu.au. This means that if I want to look up a particular IP address in that zone, I can ask sheoak.

Exactly which server is responsible for a particular zone is specified in start of authority (SOA) RRs. An SOA RR specifies, for the particular name server, the zones for which it has authority. It also has the email address of the site administrator, a unique serial number and various other bits and pieces.

A server also usually has several NS RRs, giving the names of machines which run a nameserver for the specified domain.

A resolver is a library function[1] which queries the nameserver when called from a user program. It can check the local cache of names and, if necessary, request a RR from a nameserver (caching the response). In other words, a resolver is software which asks a nameserver for information.

[1] Such as is built-in to gethostbyname(3)


Nameserver Queries

The resolver sends a question to a name server, of the form:
{query domain name, type, class}
The server responds with one or more appropriate RRs. It also sends an ADDITIONAL INFORMATION section, which contains extra RRs which the resolver will probably find useful. For example, if a resolver queries for a particular NS RR, the server will return it, plus an additional type A RR giving the IP address of the name server specified in the main body of the reply.

DNS queries and responses are encapsulated in UDP datagrams. DNS is an excellent example of an application where the reliable, connection-oriented transport mechanism of TCP is not required. If a resolver does not receive a reply from a nameserver, it usually either tries again, or tries the next nameserver for the same domain.

The most common DNS query is of type A, where the resolver is required to map a domain name to an IP address. Some typical type A RRs look like:

ironbark  86400  IN  A  149.144.21.60
redgum    86400  IN  A  149.144.21.3
bindi     86400  IN  A  149.144.20.82

Some DNS Subtleties

Mail eXchange
the DNS provides the MX type of RR to discover where email is to be delivered. An MX RR specifies a primary mailhost, and lesser preferential hosts where mail for a specified domain is be delivered. For For example, ironbark has:
ironbark  IN  MX  10  ironbark
          IN  MX  20  redgum
          IN  MX  40  sheoak
Reverse lookups
a special domain (in-addr.arpa) and address format is used to map addresses to names, thus:
60.21.144.149.in-addr.arpa
This is called a PTR RR. Performing reverse lookups is much harder than normal forward address lookups.

CNAME
Often a host may be known by several names: names other than the official host name are called aliases, and a CNAME RR maps an alias name to a host's "real" name.

HINFO
describes some basic information about the type of CPU and the OS it is running. Rarely kept up-to-date.


Extra infomation

Here's a definitive guide to DNS. This is a nice tutorial on DNS. Telstra BigPond Direct has a good explanation of the various RR types in the DNS. Here's the bare bones of another lecture on DNS, with something of a Linux emphasis.
This lecture is also available in PostScript format. The tutorial for this lecture is Tutorial #10.
La Trobe Uni Logo [Previous Lecture] [Lecture Index] [Next Lecture]
Copyright © 2000 by Philip Scott, La Trobe University.
Valid HTML 3.2!