Domain Name System

Overview

Name resolution is the process of converting host names into IP addresses. The most prevalent form of name resolution is a distributed database system called the Domain Name System (DNS).

Name Space

The set of all names used with DNS constitutes the DNS name space. This space is partitioned hierarchically and is case insensitive. The current name space is a tree of domains with an unnamed root at the top.

The top-level domains (TLDs) refer to the entries in the first level of the tree. Entries below the TLDs are called subdomains.

Domain Names

A domain name consists of a sequence of labels separated by periods.

A fully qualified domain name (FQDN) is a complete DNS name. They are sometimes written more formally with a trailing period to indicate the name is complete. In constract to the FQDN, an unqualified domain name is often extended automatically with a default domain or domain search list during resolution.

Name Servers

A name server (or DNS server) are the servers actually queried for name resolution purposes. A zone is a subtree of the DNS name space that can be administered separately from other zones. It serves as the unit of administrative delegation. Every domain name exists within some zone, with the TLDs existing in the root zone.

At any hierarchical change point in a domain name (i.e. whenever a period appears), a different zone and containing server may be accessed to provide information for the name. This is called a delegation.

Zone information is expected to exist in at least two places, implying at least two name servers for each zone. Each server should contain identical information about a zone. One of the servers is typically designated the primary server (or master). The secondary servers (or slaves) obtain copies of the database using zone transfer.

Zone Apex

The zone apex (or root domain) is the highest level of a domain within a DNS zone. A root domain has mandatory NS and SOA records. A CNAME record is therefore not allowed to specify the root domain.

Protocol

The DNS protocol consists primarily of protocols for performing queries against the DNS and performing zone transfers.

DNS queries are recursive if the query, sent to a name server, permits the name server to act as a client itself and process the query against a different name server. It is called iterative if the name server is expected to return a list of other name servers the client can then query directly.

Message Format

The following is a diagram of the DNS message format. The same DNS message format is used for both queries and zone transfers. It always begins with a fixed 12-byte header followed by variable-length sections: queries, answers, authority records, and additional records.

dns-message-format.png

Queries

The following is a diagram of each query within the query section.

dns-query-format.png

Responses

The following is a diagram of each response within the answer, authority, and additional information sections.

dns-response-format.png

The owning name can contain an asterisk (*) to serve as a wildcard for a number of domain name labels.

Resource Records

A resource record (RR) can be seen as the actual data stored in DNS. There exist a number of different RR types that dictate how the associated data is interpreted.

A and AAAA

The address records correspond to types A and AAAA. The A records contain IPv4 addresses whereas the AAAA records contain IPv6 addresses.

CNAME

A CNAME (canonical name) record contains an alias for a single domain name. When a CNAME RR is present for a particular name, no other data is permitted.

MX

An MX record provides the name of a mail exchanger. This is a host equipped with SMTP that recieves emails on behalf of users associated with a domain name.

NS

An NS record contains the name of an authoritative DNS server that contains information for a particular zone.

SOA

An SOA (start of authority) record contains information about a zone. For example, it may contain the email address of the administrator, when the domain was last updated, etc.

SOA records also contain a serial number that must be increased anytime there is a change to the zone contents. Secondary servers reference the serial number to determine if it should initiate a zone transfer.

TXT

A TXT record contains a string value. Historically they were used for human consumption, but today they are also processed by programs.

Powered by Forestry.md