| |

Internet Backend 05 ๐ŸŒ DNS Record Types and Propagation

โฑ๏ธ Estimated read: 12 min | |

DNS is a distributed database, and the records are the rows. Each record has a type, a name, a value, and a TTL (time to live). The type determines what the value means: an A record maps a name to an IPv4 address, an AAAA record maps a name to an IPv6 address, a CNAME record maps a name to another name, and an MX record maps a domain to a mail server. The TTL determines how long a resolver is allowed to cache the record before it asks the authoritative server again. The propagation is not a push from the authoritative server to the world; it is the gradual expiry of the cached copies in every resolver that has looked up the record. The record is “propagated” when the old TTL has expired everywhere, and the new value is what the resolvers fetch.

The record types are grouped by function. The address records (A, AAAA) map the names to the IP addresses. The alias records (CNAME) map the names to the other names. The delegation records (NS, SOA) describe the zone’s authority and its metadata. The service records (MX, SRV) describe where the services live. The security records (TXT, CAA, and the DNSSEC records) describe the policies and the signatures . The CNAME is the record that cannot coexist with the other records at the same name, and it is forbidden at the zone apex. The SOA is the record that carries the negative-caching TTL, which is the mechanism that tells the resolvers how long to cache the “does not exist” answers.

Key point: The record type determines the meaning of the value, and the TTL determines the cache duration. The propagation is the TTL expiry, not a push. The A and AAAA records map the names to the IP addresses, the CNAME maps the names to the other names (and is forbidden at the apex), the MX and SRV locate the services, the TXT and CAA carry the policies, and the DNSSEC records (RRSIG, DNSKEY, DS, NSEC) provide the cryptographic integrity.


Why the TTL is the propagation mechanism

The caching problem. DNS is a hierarchical database, and the root servers and the TLD servers are queried by every resolver in the world. If every query went to the authoritative server, the load would be unmanageable. The caching is the mechanism that reduces the load: the resolver stores the answer for the TTL duration, and it serves the cached answer for the subsequent queries. The TTL is the contract between the authoritative server and the resolver: “this answer is valid for this many seconds” .

The propagation illusion. The term “propagation” is misleading. The authoritative server does not push the new record to the resolvers. The resolvers keep the old record until the TTL expires, and then they fetch the new record. The propagation time is the maximum TTL of the old record. If the TTL is 3600 seconds, the old record can be cached for up to an hour after the change, and the new record is visible only after that hour . The propagation is the cache expiry, not a broadcast.

The planned-change problem. A record with a long TTL is efficient for the steady state, but it is slow for a planned change. The standard procedure is to lower the TTL before the change, wait for the old TTL to expire, make the change, and then raise the TTL back. The lowering is the mechanism that makes the change visible quickly. The procedure is the trade-off between the steady-state efficiency and the change agility .

The negative caching problem. The “does not exist” answers are also cached. The SOA record’s minimum TTL is the negative-caching TTL, and the resolvers cache the NXDOMAIN for that duration. The negative caching is the mechanism that prevents the repeated queries for the nonexistent names, but it is also the reason a newly created record can be invisible for the negative-cache TTL .


a. The address, alias, and delegation records

The A record maps a name to an IPv4 address. The AAAA record maps a name to an IPv6 address. The two are the address records, and they are the most common. The A record’s value is a 32-bit address, and the AAAA record’s value is a 128-bit address . The two records can coexist at the same name, which is the dual-stack configuration.

www.example.com.  3600  IN  A     192.0.2.1
www.example.com.  3600  IN  AAAA  2001:db8::1

The CNAME record maps a name to another name. The resolver follows the CNAME and looks up the target. The CNAME is the alias mechanism, and it is used for the subdomains that point to a canonical name, such as the www pointing to the bare domain or a CDN hostname . The CNAME cannot coexist with the other records at the same name, because the alias is exclusive. The CNAME is forbidden at the zone apex because the apex must have the NS and SOA records.

www.example.com.  3600  IN  CNAME  example.com.

The NS record delegates a zone to the nameservers. The SOA record is the zone’s metadata: the primary nameserver, the contact, the serial number, and the timers. The SOA is the record that the secondary nameservers use to decide when to transfer the zone, and its minimum TTL is the negative-caching TTL .

example.com.  86400  IN  NS   ns1.example.com.
example.com.  86400  IN  SOA  ns1.example.com. admin.example.com. (
                              2024010101 ; serial
                              7200       ; refresh
                              3600       ; retry
                              1209600    ; expire
                              300        ; minimum (negative TTL)
                              )

The PTR record maps an IP address to a name. It is the reverse DNS record, and it lives in the in-addr.arpa zone for IPv4 and the ip6.arpa zone for IPv6. The PTR is used for the reverse lookups, the email reputation, and the logging .


b. The service, policy, and security records

The MX record maps a domain to a mail server. The value has a priority and a hostname. The lower priority is preferred, and the multiple records provide the redundancy. The MX is the record that the email delivery uses to find the mail server for the domain .

example.com.  3600  IN  MX  10  mail1.example.com.
example.com.  3600  IN  MX  20  mail2.example.com.

The SRV record maps a service to a host and a port. It is the generic service record, and it is used for the protocols that need the service discovery, such as the SIP, the XMPP, and the LDAP. The value has a priority, a weight, a port, and a target .

The TXT record stores the arbitrary text. It is the record that carries the SPF, the DKIM, and the DMARC policies for the email authentication, and the domain verification strings for the third-party services . The TXT is the policy record, and the multiple strings can be stored in the same record.

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

The CAA record restricts the certificate authorities that are allowed to issue the certificates for the domain. The value has a flag, a tag (issue, issuewild, iodef), and a value. The CAA is the policy that the CAs check before they issue the certificate, and it is mandatory since September 2017 .

example.com.  3600  IN  CAA  0 issue "letsencrypt.org"

The DNSSEC records are the integrity mechanism. The RRSIG is the digital signature of the record set. The DNSKEY is the public key that verifies the signature. The DS is the delegation signer record in the parent zone, and it is the link in the chain of trust. The NSEC (or NSEC3) is the record that proves the nonexistence of a name . The DNSSEC does not encrypt the DNS data; it only proves the integrity. The validating resolver checks the signatures from the root down to the zone, and it marks the answer as secure, insecure, bogus, or indeterminate .


Complete Example Session

// ============================================
// PART 1: THE ZONE FILE
// ============================================

$TTL 3600
@   IN  SOA ns1.example.com. admin.example.com. (
        2024010101 ; serial
        7200       ; refresh
        3600       ; retry
        1209600    ; expire
        300        ; minimum (negative TTL)
        )

// ============================================
// PART 2: THE DELEGATION
// ============================================

@   IN  NS  ns1.example.com.
@   IN  NS  ns2.example.com.

// ============================================
// PART 3: THE ADDRESS RECORDS
// ============================================

@       IN  A     192.0.2.1
@       IN  AAAA  2001:db8::1
www     IN  A     192.0.2.2
www     IN  AAAA  2001:db8::2

// ============================================
// PART 4: THE MAIL RECORDS
// ============================================

@       IN  MX  10  mail1.example.com.
@       IN  MX  20  mail2.example.com.
mail1   IN  A   192.0.2.10
mail2   IN  A   192.0.2.20

// ============================================
// PART 5: THE POLICY RECORDS
// ============================================

@       IN  TXT  "v=spf1 mx -all"
@       IN  CAA  0 issue "letsencrypt.org"

// ============================================
// PART 6: THE ALIAS
// ============================================

// The CNAME points the subdomain to the bare domain.
// The CNAME is forbidden at the apex (@).
blog    IN  CNAME  www.example.com.

// ============================================
// PART 7: THE REVERSE DNS
// ============================================

// The PTR record lives in the in-addr.arpa zone.
1.2.0.192.in-addr.arpa.  IN  PTR  www.example.com.

// ============================================
// PART 8: THE DNSSEC RECORDS
// ============================================

// The DNSKEY is the public key.
// The RRSIG is the signature of the record set.
// The DS is the delegation signer in the parent zone.
// The NSEC proves the nonexistence.

// ============================================
// PART 9: THE TTL AND THE PROPAGATION
// ============================================

// The TTL is 3600 seconds (1 hour).
// A change is visible after the old TTL expires.
// The planned change: lower the TTL to 300, wait 1 hour, change, raise to 3600.

// ============================================
// PART 10: THE CHECKLIST
// ============================================

// [ ] The A and AAAA records are set.
// [ ] The CNAME is not at the apex.
// [ ] The MX records have the priorities.
// [ ] The TXT records carry the SPF and the verification.
// [ ] The CAA record restricts the CAs.
// [ ] The SOA record has the negative-caching TTL.
// [ ] The DNSSEC records are present if the zone is signed.
// [ ] The TTL is appropriate for the change frequency.

The ten parts covered the zone file, the delegation, the address records, the mail records, the policy records, the alias, the reverse DNS, the DNSSEC records, the TTL and the propagation, and the checklist. The through-line is that the record type determines the meaning, and the TTL determines the propagation.


Quick Reference

The record types

TypePurposeValue
AIPv4 address32-bit address
AAAAIPv6 address128-bit address
CNAMEAliasAnother name
NSNameserver delegationNameserver hostname
SOAZone metadataPrimary NS, contact, serial, timers
MXMail serverPriority + hostname
TXTText policySPF, DKIM, DMARC, verification
CAACA restrictionFlag, tag, value
PTRReverse DNSHostname
SRVService locatorPriority, weight, port, target
RRSIGDNSSEC signatureSignature of the record set
DNSKEYDNSSEC public keyPublic key
DSDelegation signerHash of the child’s DNSKEY
NSECProof of nonexistenceNext secure record

The TTL and the propagation

TTLPropagationUse case
3005 minutesThe planned change
36001 hourThe steady state
8640024 hoursThe stable records (NS)

The DNSSEC states

StateMeaning
SecureThe signatures are verified
InsecureThe zone is not signed
BogusThe signatures fail
IndeterminateNo trust anchor

Best Practices

โœ… Do This:

// Use the CNAME only for the non-apex names
blog  IN  CNAME  www.example.com.                           // โœ…

// Set the CAA record to restrict the CAs
@     IN  CAA  0 issue "letsencrypt.org"                    // โœ…

// Lower the TTL before a planned change
// Change the TTL to 300, wait for the old TTL to expire, make the change, raise the TTL.

โŒ Don’t Do This:

// Use the CNAME at the apex
@  IN  CNAME  example.com. // the apex needs the NS and SOA   // โŒ

// Use the CNAME with the other records at the same name
www  IN  CNAME  target.com.
www  IN  A      192.0.2.1 // the CNAME is exclusive          // โŒ

Common Pitfalls

PitfallWhy It HappensFix
The change is not visibleThe old TTL is cachedLower the TTL before the change
The CNAME is rejectedThe CNAME is at the apexUse the A/AAAA or the ALIAS
The email is marked as spamThe SPF/DKIM/DMARC is missingAdd the TXT records
The certificate issuance failsThe CAA does not allow the CAUpdate the CAA record
The negative answer is cachedThe SOA minimum TTL is highLower the negative TTL

Summary

ItemValue
A / AAAAThe IPv4 / IPv6 address
CNAMEThe alias; forbidden at the apex
NS / SOAThe delegation and the zone metadata
MX / SRVThe mail and the service locators
TXT / CAAThe policy records
PTRThe reverse DNS
DNSSECRRSIG, DNSKEY, DS, NSEC
PropagationThe TTL expiry, not a push

Key takeaways:

  • The record type determines the meaning of the value. The A and AAAA map the names to the addresses, the CNAME maps the names to the other names, the MX and SRV locate the services, and the TXT and CAA carry the policies .
  • The TTL is the propagation mechanism. The authoritative server does not push the changes; the resolvers cache the records for the TTL duration, and the new value is visible only after the old TTL expires . The planned change requires lowering the TTL before the change .
  • The CNAME is exclusive and forbidden at the apex. The alias cannot coexist with the other records at the same name, and the apex must have the NS and SOA records. The ALIAS or the A/AAAA is the alternative at the apex.
  • The CAA record is the CA restriction policy. The certificate authorities check it before they issue the certificate, and it is mandatory since 2017 . The missing CAA means any CA can issue.
  • The DNSSEC provides the integrity, not the confidentiality. The RRSIG, DNSKEY, DS, and NSEC records prove that the answer matches the zone’s data and was not altered in transit . The DNSSEC does not encrypt the data.

Remember: DNS records are typed values with a TTL. The type is the meaning, and the TTL is the cache duration. The propagation is the TTL expiry, not a push. The A/AAAA map the addresses, the CNAME maps the aliases, the MX and SRV locate the services, the TXT and CAA carry the policies, and the DNSSEC records provide the integrity. The planned change requires lowering the TTL before the change, and the CNAME is forbidden at the apex. The records are the database rows, and the TTL is the contract.

Was this helpful?


Stop using slow, ad-bloated tool sites! ๐Ÿคฎ

๐Ÿ”Ž Search “KandZ Tools” on Google to use many professional utilities for free.

KandZ.me is the ultimate minimalist hub for:
โœ… Finance (Mortgage, Interest, Inflation)
โœ… Tech (Base64, JSON, Dev Suite, IP)
โœ… Health (BMI, BMR, TDEE)
โœ… Productivity (Timer, Workspace, QR)

โšก๏ธ Fast & Private
๐Ÿ”’ No data leaves your device
๐Ÿ’Ž 100% Free

๐Ÿ”— Use it now: https://tools.kandz.me
๐Ÿ”– Bookmark itโ€”youโ€™ll need it later!