Sobes.tech
Junior

What DNS records do you know?

sobes.tech AI

Answer from AI

There are many types of DNS records, each serving a specific role in the domain name system. The main ones include:

  • A (Address Record): Links a domain name to an IPv4 address. This is the most common record used for directly specifying the location of a resource on the network.

    // Example A record
    example.com A 192.0.2.1
    
  • AAAA (IPv6 Address Record): Similar to the A record but links a domain name to an IPv6 address.

    // Example AAAA record
    example.com AAAA 2001:db8::1
    
  • CNAME (Canonical Name Record): Creates an alias for another domain name. Used to simplify management by linking multiple names to a single resource.

    // Example CNAME record
    www.example.com CNAME example.com
    
  • MX (Mail Exchange Record): Specifies mail servers responsible for receiving email for the domain, along with their priority.

    // Example MX records
    example.com MX 10 mail.example.com
    example.com MX 20 backupmail.example.com
    
  • TXT (Text Record): Used to store textual information about the domain. Often used for security settings (SPF, DKIM, DMARC) and domain ownership verification.

    // Example TXT record for SPF
    example.com TXT "v=spf1 include:_spf.google.com ~all"
    
  • PTR (Pointer Record): Used for reverse DNS resolution, linking an IP address to a domain name. Mainly used for rDNS implementation and in mail systems to verify sender legitimacy.

    // Example PTR record in reverse zone
    1.2.0.192.in-addr.arpa PTR example.com
    
  • NS (Name Server Record): Indicates authoritative DNS servers for a domain or subdomain. These servers provide DNS zone information for the domain.

    // Example NS records
    example.com NS ns1.example.com
    example.com NS ns2.example.com
    
  • SOA (Start of Authority Record): Contains primary information about the DNS zone, including the primary server name, contact person, zone serial number, and caching timings.

    // Example SOA record
    example.com SOA ns1.example.com admin.example.com (
         2023110101 ; Serial
         3600       ; Refresh
         1800       ; Retry
         604800     ; Expire
         86400      ; Minimum TTL
    )
    

Beyond these main types, there are other less common ones used for specialized purposes, such as:

  • SRV (Service Record): Defines the location (host and port) of servers for specific services.
  • DNSKEY (DNS Key Record): Contains a public key for DNSSEC signature verification.
  • DS (Delegation Signer Record): Links parent and child zones in the DNSSEC chain.
  • NAPTR (Naming Authority Pointer Record): Used in telephony (ENUM) to convert phone numbers into URIs.