Skip to content

Common DNS Record Types

One-Liner

The different types of resource records used in DNS to provide information about a domain.

What It Is

DNS records are instructions that live in authoritative DNS servers and provide information about a domain, including its IP address, mail servers, and more.

Why It Exists

To provide a standardized way to store different types of information about a domain.

How It Works

  • A Record: Maps a domain name to an IPv4 address.
  • AAAA Record: Maps a domain name to an IPv6 address.
  • CNAME Record (Canonical Name): Maps one domain name to another (an alias).
  • MX Record (Mail Exchange): Specifies the mail servers for a domain.
  • NS Record (Name Server): Specifies the authoritative nameservers for a domain.
  • TXT Record: Allows an administrator to store arbitrary text in the record. Used for various purposes like email security (SPF, DKIM).

Tradeoffs

A vs. CNAME

  • An A record points directly to an IP, while a CNAME points to another domain. CNAMEs are more flexible if the IP address changes, but have some restrictions (e.g., a CNAME cannot be placed at the root of a domain).

Failure Modes

  • CNAME Misconfiguration: Pointing a CNAME to another CNAME can create long lookup chains and increase latency.
  • Missing MX records: Mail for the domain will not be delivered.

Interview Traps

  • Not knowing the most common record types (A, CNAME, MX).
  • Not understanding the difference between an A record and a CNAME record.

Real-World Usage

  • Every domain on the internet uses a combination of these record types.

Anti-Patterns

  • Using a CNAME record for the root domain.
  • DNS Resolution Process
  • DNS Caching