DNS Resource Records

In this post I am laying some concepts on the DNS resource records.

DNS Resource Record RR

A name server contains one or more Resource Records (RR). When a DNS server is queried, it may answer with one or more resource records, depending on the type of the query.

A resource record is in the following format:

Name, TTL, Class, Type, rdata

  • Name: the domain name
  • TTL: Time to Live: the amount of time the RR can exist in a DNS server cache. This is similar to the concept of IP TTL field but not to be confused with.
  • Class: you will almost always find this field equal to “IN”, which means INternet
  • Type: defines the type of the RR. The most common types are: A, NS, CNAME and MX. The Type field defines what “Name” and “rdata” will be.
  • rdata: also known as Value in some other documentation. This is the record data.

Some DNS Resource Record Types

We said that resource records are in the format: Name, TTL, Class, Type, rdata.

  • If Type = A, then the resource record is an “A record” and it simply provides the hostname-to-IP mapping. So:
    • Name = alias hostname
    • rdata = IP address mapped to the alias hostname

There can be multiple A records for the same domain name (many IP addresses are mapped to the same domain name). Similarly, there can be multiple A records for the same IP address (many domain name pointed to the same IP address).

  • If Type = NS, then the resource record is a “NS record”. This record does not provide a hostname-to-IP mapping. Instead, it provides a hostname of a name server that has authority on a domain that contains the hostname. So
    • Name = alias hostname,
    • rdata = hostname of a name server that has authority on the domain that contains Name
  • If Type = CNAME, then the record is a “CNAME record”. This record provides the canonical hostname of an alias hostname:
    • Name = alias hostname,
    • rdata = canonical hostname
  • If Type = MX, then the record is an “MX record”. It provides the hostname of a mail server that maps to the alias hostname.
    • Name = alias hostname
    • rdata = hostname of the email server

The complete list of DNS record types can be found here.

DNS Glue Records

Sometimes the name server we query is not an authoritative name server for the domain we want to resolve. In that case, the name server replies with a record that contain the domain name of an authoritative name server. However, this by itself may cause a loop because we don’t know how to reach the authoritative name server. For that reason, name servers often give additional information about the authoritative name server (such as an A record) in the Additional Record section.

TLDs often can reply with glue records because they have the IP addresses of authoritative name servers configured on them.

DNS Query Examples

Google provides a tool to do DNS queries, as part of their Google Apps series. I’m going to use it and query the default Google DNS server for the resource records I have mentioned above.

Example 1: DNS A record

When I query the default Google DNS server for an A record for the domain keyboardbanger.com, I get the IP address, which is 213.186.33.40:

dns-14
Figure: A record

Example 2: DNS NS record

When queried, the DNS server provides the NS record that shows the hostname of name servers that have authority on the domain Keyboardbanger.com: ns111.ovh.net and dns111.ovh.net

dns-15
Figure: NS record

Example 3: DNS CNAME record

As described earlier, the CNAME record provides the canonical hostname of an alias hostname. The canonical hostnames of Keyboardbanger.com are dns111.ovh.net and tech.ovh.net

dns-cname-record-example
Figure: CNAME record

Example 4: DNS MX record

The hostname of the email server associated with the alias hostname of Keyboardbanger.com  is redirect.ovh.net

dns-mx-record-example
Figure: MX record

Comments

Popular posts from this blog

The Thing With CUCM Device Packs

En Bloc Dialing vs Digit-By-Digit Dialing

Call Forward And Call Hunt on CUCM