DNS Record Types, Zones and Propagation
On this page
DNS record types: A, AAAA, CNAME, MX, TXT and more
Setting up a domain means editing a zone: the set of records an authoritative nameserver serves for that domain. A handful of record types cover almost everything.
| Type | Maps | Example |
|---|---|---|
| A | Name to IPv4 address | example.com. A 104.20.23.154 |
| AAAA | Name to IPv6 address | example.com. AAAA 2606:4700:10::6814:179a |
| CNAME | Name to another name (an alias) | www.github.com. CNAME github.com. |
| MX | Domain to its mail servers, with priority | example.com. MX 10 mail.example.com. |
| TXT | Name to free text | SPF, DKIM, DMARC, domain ownership checks |
| NS | Zone to its authoritative nameservers | example.com. NS hera.ns.cloudflare.com. |
| SOA | Zone metadata: primary server, serial, timers | One per zone |
| CAA | Which certificate authorities may issue for the domain | example.com. CAA 0 issue "letsencrypt.org" |
| SRV | Service to host and port | Used by SIP, some service discovery |
DNS rules that catch people out
- No CNAME at the zone apex.
example.comitself has NS and SOA records, and a CNAME can't coexist with other records. DNS providers offer workarounds (ALIAS, ANAME or "CNAME flattening") that resolve the target and serve it as an A record. - MX and NS must point to names, not IPs, and those names need their own A or AAAA records.
- TXT records do a lot of security work. Real examples:
dig +short TXT example.com
dig +noall +answer _dmarc.google.com TXT"v=spf1 -all"
_dmarc.google.com. 181 IN TXT "v=DMARC1; p=reject; rua=mailto:mailauth-reports@google.com"v=spf1 -all says no server may send mail for example.com, a good setting for any domain that doesn't send email. Google's DMARC policy tells receivers to reject mail that fails authentication.
The SOA record
example.com. 1800 IN SOA elliott.ns.cloudflare.com. dns.cloudflare.com. 2416374680 10000 2400 604800 1800The fields: primary nameserver, the administrator's contact (as a name), the serial number (which increases with every change), refresh, retry and expire timers for secondary servers, and the last number, 1800 seconds here, which sets how long resolvers cache negative answers.
DNS propagation is really cache expiry
DNS changes don't spread outwards. The authoritative servers update almost immediately; what takes time is caches around the world holding the old answer until its TTL runs out. To check a change:
dig @hera.ns.cloudflare.com +short example.com A # the source of truth
for r in 8.8.8.8 1.1.1.1 9.9.9.9; do echo "$r: $(dig @$r +short example.com A | tr '\n' ' ')"; done8.8.8.8: 104.20.23.154 172.66.147.243
1.1.1.1: 104.20.23.154 172.66.147.243
9.9.9.9: 104.20.23.154 172.66.147.243If the authoritative server shows the new value and public resolvers don't, wait out the TTL. If the authoritative server shows the old value, the change wasn't published, or you edited the zone at a provider the domain's NS records don't point to. Browsers and operating systems have their own caches too.
Changing nameservers is slower: NS records at the TLD often have TTLs of a day or two.
Check yourself
The apex must hold NS and SOA records, and a CNAME can't coexist with any other record for the same name; use your provider's ALIAS or flattening feature instead.
Query the authoritative nameserver directly with dig @ns1.yourdns.com name. If it already returns the new value, the change is published and 8.8.8.8 is serving its cached copy until the old TTL runs out. If not, the change didn't save or you edited the wrong zone.
No server is authorized to send email for that domain, so receivers should reject mail claiming to come from it. It's a good record for domains that never send email, protecting them from being spoofed.
An A record maps a name to an IPv4 address. An MX record names the mail servers for a domain, with priorities, and must point to a hostname, not an IP.
It names the zone's primary nameserver and administrator and holds the serial number and timers secondary servers use to know when to refresh, plus the TTL for negative answers.