This article is a detailed overview of the Internet's Domain Name System (DNS), covering the technical and theoretical aspects behind how domain names work.
A domain name usually consists of two or more parts (technically labels), separated by dots. For example: mediatemple.net.
- The rightmost label conveys the top-level domain.
- Each label to the left specifies a subdivision or subdomain of the domain above it. Note that "subdomain" expresses relative dependence, but not absolute dependence: for example, mediatemple.net comprises a subdomain of the net domain, and www.mediatemple.net comprises a subdomain of the domain mediatemple.net. In theory, this subdivision can go down to 127 Levels deep, and each label can contain up to 63 characters, as long as the whole domain name does not exceed a total length of 255 characters. But in practice some domain registries have shorter limits than that.
- A hostname refers to a domain name that has one or more associated IP addresses. For example, the wiki.mediatemple.net and mediatemple.net domains are both hostnames.
The Domain Name System consists of a hierarchical set of DNS servers. Each domain or subdomain has one or more authoritative DNS servers that publish information about that domain and the nameservers of any domains "beneath" it. The hierarchy of authoritative DNS servers matches the hierarchy of domains. At the top of the hierarchy stand the root nameservers: the servers to query when looking up (resolving) a top-level domain name (TLD). Iterative and recursive queries:
- An iterative query is one where the DNS server may provide a partial answer to the query (or give an error). DNS servers must support non-recursive queries.
- A recursive query is one where the DNS server will fully answer the query (or give an error). DNS servers are not required to support recursive queries and both the resolver (or another DNS acting recursively on behalf of another resolver) negotiate use of recursive service using bits in the query headers.
DNS Propagation refers to the time for any DNS changes to transmit across the Internet. Please remember that DNS changes in general can take up to 24-48 hours to fully propagate.
The root domain (also sometimes referred to as the "parent," "naked," or "apex" domain) is the primary entry for the domain without any subdomains. The NAME field typically remains blank as this would define a subdomain. This type of record should usually be an A record, with the value set to the destination IP address. Using a CNAME for the root domain can cause other DNS functions, such as MX records, to route incorrectly. It is standard practice to set the A record for the root domain to that of the "www." subdomain.
CNAME or "Canonical Name"
CNAME Records are used to define an alias hostname. A CNAME record takes this format:
alias.domain.name IN CNAME otherhost.domain.name.
This defines alias.domain.name as an alias for the host whose canonical (standard) name is otherhost.domain.name.
An A record gives you the IP address of a domain. That way, users that try to go to www.example.com will get to the right IP address. An A record or "Address Record" maps a hostname to a 32-bit IPv4 address. An "A" Record takes this format (example):
Name TTL TYPE DATA ftp.domain.com 43200 A IP Address
Media Temple DNS Zone files are written with a "wildcard" entry, that looks like this:
*.domain.com IN A xxx.xxx.xxx.xxx
The x's represent your particular IP address. The star takes "anything" .domain.com and points it to your server's IP address. This way, if someone mistakenly types too many or too few w's, they'll still see your website. This is also useful for setting up subdomains on your server, relieving you of the duty of adding an additional "A" record for the subdomain.
Mail Exchange Record: Maps a domain name to a list of mail exchange servers for that domain. A zone can have one or more Mail Exchange (MX) records. These records point to hosts that accept mail messages on behalf of the host. A host can be an 'MX' for itself. MX records need not point to a host in the same zone. An 'MX' record takes this format:
host.domain.name IN MX 10 otherhost.domain.name. IN MX 20 otherhost2.domain.name.
The 'MX' preference numbers nn (value 0 to 65535) signify the order in which mailers select 'MX' records when they attempt mail delivery to the host. The lower the 'MX' number, the higher the host is in priority.
PTR Record / Pointer Record
Maps an IPv4 address to the canonical name for that host. Setting up a PTR record for a hostname in the in-addr.arpa. domain that corresponds to an IP address implements reverse DNS lookup for that address. For example, at the time of writing, www.icann.net has the IP address 126.96.36.199, but a PTR record maps 188.8.131.52.in-addr.arpa to its canonical name.
NS Record or "Name Server Record"
Maps a domain name to a list of DNS servers authoritative for that domain. In this case, for (mt) Media Temple purposes would be:
SOA Record or "Start of Authority Record"
Specifies the DNS server providing authoritative information about an Internet domain, the email of the domain administrator, the domain serial number, and several timers relating to refreshing the zone.
The TXT Record allows an administrator to insert arbitrary text into a DNS record. For example, this record is used to implement the Sender Policy Framework and DomainKeys specifications.