Friday, May 20, 2011

Intro to DNS

The Domain Name System (DNS) is a hierarchical naming system used to organize and identify domains, similar to a phone book. Essentially, DNS translates meaningful domains names to IP addresses for the purpose of locating and addressing networking devices worldwide. For instance, the domain name might translate to This makes it much easier to remember URLs and email addresses.

A Records

A records (also known as host records) link a domain, or subdomain, to an IP address.

A records do not necessarily match IP addresses on a one-to-one basis. Many A records correspond to a single IP address where one machine serves many web sites. Alternatively, a single A record may correspond to many IP addresses to facilitate fault tolerance and load distribution.

An A record includes the following fields:
  • Host Name:

    The domain name.

  • IP Address:

    The IP address of the web server hosting the domain.

  • TTL:

    "Time to Live." How long it will take to update the record. This is measured in seconds. A TTL of 3600 seconds means records will take an hour to update. A TTL of 86400 means records will take a day to update. A higher TTL value means less traffic load for the DNS server, but it also means that changing the MX records will take longer.

CNAME Records

Canonical name (CNAME) records specify that a domain name is an alias of another domain name.

This helps when running multiple services from a single IP address. For example, an FTP and a web server may be located at a single IP address but running on different ports. Each service would then have its own entry in DNS, such as and

A CNAME record includes the following fields:
  • Host Name or Alias:

    The domain name that is being setup to point to another location.

  • URL or Alias For:

    The domain name to which the alias points.

  • TTL:

    "Time to Live." How long it will take to update the record.

When a DNS resolver encounters a CNAME record while looking for a regular resource record, it will restart the query using the canonical name instead of the original name. The canonical name that a CNAME record points to can be anywhere in the DNS, whether local or on a remote server in a different DNS zone.

For example, if your blog was available at, you could setup a CNAME to point your domain to the Blogger URL. Your readers would then visit to view your blog.   CNAME
This example record may be read as is an alias for the canonical name (CNAME)

MX Records

Mail Exchange (MX) records direct email a domain's mail flow.

Most domains have multiple MX records arranged in order of priority. When someone sends an email message to the domain, the first available server in the priority list handles the message.

An MX record includes the following fields:

  • Name:

    The name of your domain.

  • Class:

    This is always set to IN, which stands for Internet.

  • Type:

    For MX records, this is always set to MX.

  • TTL:

    "Time to Live." How long it will take to update the record.

  • Preference or Priority:

    The order of preference for mail delivery. Sending servers should try the lowest preference number first, then the next lowest, and so on.
    Data: The host name of the mail server that handles mail for that domain.

For instance, if your domain is, your MX records might look like this: IN MX 86400 1 IN MX 86400 2 IN MX 86400 3 IN MX 86400 4

TXT Records

A TXT-record provides the ability to associate some arbitrary and unformatted text with a host or other name. They are often used to establish SPF records, which are explained in-depth in another blog post [link].

NS Records

Name server records determine which servers will communicate DNS information for a domain. Two NS records must be defined for each domain. Generally, you will have a primary and a secondary name server record. NS records are updated with your domain registrar and will take 24-72 hours to take effect.