Types of DNS Records Every Developer Should Know

·

3 min read

DNS records are essential components of the Domain Name System (DNS). They store information about a domain and help route internet traffic efficiently. Here's an overview of the most common types of DNS records you should know:


1. A Record (Address Record)

  • Purpose: Maps a domain name to an IPv4 address.

  • Example: example.com → 192.0.2.1


2. AAAA Record (IPv6 Address Record)

  • Purpose: Maps a domain name to an IPv6 address.

  • Example: example.com → 2001:db8::1


3. CNAME Record (Canonical Name Record)


4. MX Record (Mail Exchange Record)

  • Purpose: Specifies the mail server(s) responsible for receiving emails for the domain.

  • Example:

      Priority 10: mail1.example.com  
      Priority 20: mail2.example.com
    

5. TXT Record (Text Record)

  • Purpose: Stores text information for external verification (e.g., SPF, DKIM, DMARC, or custom notes).

  • Example:

      "v=spf1 include:_spf.example.com ~all"
    

6. NS Record (Name Server Record)

  • Purpose: Specifies the authoritative DNS servers for the domain.

  • Example:

      example.com  ns1.exampledns.com  
      example.com  ns2.exampledns.com
    

7. SOA Record (Start of Authority Record)

  • Purpose: Provides administrative information about the domain, such as the primary name server, admin email, and timing parameters for DNS updates.

  • Example:

      Primary NS: ns1.exampledns.com  
      Admin Email: admin@example.com  
      Refresh Time: 3600
    

8. PTR Record (Pointer Record)

  • Purpose: Maps an IP address to a domain name (reverse DNS lookup).

  • Example:

      192.0.2.1  example.com
    

9. SRV Record (Service Record)

  • Purpose: Specifies services like VoIP or instant messaging for a domain.

  • Example:

      Service: _sip  
      Protocol: _tcp  
      Priority: 10  
      Weight: 5  
      Port: 5060  
      Target: sip.example.com
    

10. ALIAS or ANAME Record

  • Purpose: Similar to a CNAME but works at the root level of a domain, which CNAME cannot do.

  • Example:

      example.com  someotherdomain.com
    

11. DNSSEC Records (DNS Security Extensions)

  • Purpose: Used to verify the authenticity and integrity of DNS data.

  • Common DNSSEC Record Types:

    • DS (Delegation Signer)

    • RRSIG (DNSSEC Signature)

    • DNSKEY (DNS Key)

    • NSEC (Next Secure Record)


12. SPF Record (Sender Policy Framework)

  • Purpose: Prevents email spoofing by specifying which mail servers can send emails on behalf of the domain.

  • Example:

      "v=spf1 ip4:192.0.2.1 -all"
    

13. HINFO Record (Host Information Record)

  • Purpose: Describes the hardware and operating system of a host.

  • Example:

      "CPU: Intel Xeon"  
      "OS: Ubuntu Linux"
    

14. NAPTR Record (Naming Authority Pointer)

  • Purpose: Used for more complex redirection like SIP (Session Initiation Protocol) or ENUM services.

  • Example:

      Order: 100  
      Preference: 10  
      Flags: "S"  
      Service: "E2U+email"  
      Regexp: "!^.*$!mailto:info@example.com!"  
      Replacement: .
    

These DNS records provide the backbone for how the internet resolves names and routes traffic. Depending on your needs, some records (e.g., A, CNAME, MX, TXT) will be used frequently, while others (e.g., DNSSEC, NAPTR) are more specialized.