DNS Cheat Sheet: Record Types, TTLs, SPF, DMARC and dig
Checked against DNS RFC 1035, 2181, 2308, 7208, 8659, 9989; dig from BIND 9.20.31 docs; lookups run on Node 24.4.0 on 28 November 2026. Each section links to the official docs it was checked against.
This sheet is for developers who edit DNS a few times a year and want the record syntax and the rules that bite without rereading the RFCs. Record rules come from the RFCs themselves, including RFC 9989, the DMARC standard published in May 2026. The live lookups were run with Node 24.4.0's dns module against 1.1.1.1; dig rows are from the BIND 9.20.31 manual and are marked untested.
When to use what
Pick the record by what the name should do. A name that points at a server gets A and AAAA. A name that should follow another name gets a CNAME, but only if that name has no other records at all, which is why you can't put a CNAME on the zone apex: the apex always needs SOA and NS. Providers work around this with their own flattening or alias records; those are vendor features, not DNS standards. Mail routing is MX; mail authentication (SPF, DKIM, DMARC) is all TXT.
Set TTLs with the next change in mind, not the current one. A resolver may keep a record for the full TTL, so if you plan to move a site, drop the TTL a day ahead and raise it after. Remember that a miss is cached too: when a name doesn't exist, resolvers cache that answer for the smaller of the SOA's own TTL and its MINIMUM field, so creating a record right after someone looked it up can still look broken for a while.
For quick checks use our DNS lookup, and the propagation checker when you need to see several resolvers at once. The DNS records guide explains each type in more depth.
AAAA is defined in RFC 3596, SRV in RFC 2782 and CAA in RFC 8659. A trailing dot makes a name absolute; without it the zone origin is appended.
www 3600 IN A 192.0.2.10IPv4 address for a host name, cached for an hour
www 3600 IN AAAA 2001:db8::10IPv6 address for the same name; publish both if the server has both
blog 3600 IN CNAME example.github.io.Make blog an alias of another name; blog may then have no other records
@ 3600 IN MX 10 mail.example.com.Mail for the domain goes to mail.example.com; lower preference numbers are tried first
@ IN MX 0 .Null MX: the domain accepts no mail at all (RFC 7505)
@ 86400 IN NS ns1.example.net.Delegate the zone to a name server; MX and NS targets must not be CNAMEs
@ 3600 IN TXT "v=spf1 mx -all"Free-text record; each quoted string is at most 255 characters
_sip._tcp 3600 IN SRV 10 60 5060 sip.example.com.Service location: priority, weight, port, target
@ 3600 IN CAA 0 issue "ca1.example.net"Only the named CA may issue certificates for this domain; issuewild covers wildcards
10.2.0.192.in-addr.arpa. IN PTR www.example.com.Reverse lookup for 192.0.2.10; set by whoever owns the IP block
CNAME + anything else on the same nameNot allowed: a name with a CNAME can have no other data (DNSSEC records aside)
MX / NS target that is a CNAMENot allowed: the value of an MX or NS record must be a canonical name
TTL 0 to 2147483647Valid TTL range in seconds (2^31 - 1); 0 means do not cache
Label <= 63 octets, name <= 255 octetsHard length limits; long DKIM or verification names can hit them
Several PTR records for one IPAllowed: RFC 2181 says no rule limits a name to a single PTR
SOA fields in order, from RFC 1035 section 3.3.13: MNAME, RNAME, SERIAL, REFRESH, RETRY, EXPIRE, MINIMUM.
@ 3600 IN SOA ns1.example.net. hostmaster.example.com. 2026112801 7200 3600 1209600 300Zone start: primary server, contact mailbox, serial, refresh, retry, expire, negative TTL
NXDOMAINThe name does not exist at all; cached for min(SOA TTL, SOA MINIMUM)
NODATA (NOERROR, empty answer)The name exists but has no record of the type you asked for; cached the same way
SOA MINIMUMNow means the negative-caching TTL; the old 'minimum TTL for the zone' meaning is deprecated
DKIM is RFC 6376 and DMARC is RFC 9989 (https://www.rfc-editor.org/rfc/rfc9989.txt). All three are TXT records; only the name and the leading tag differ.
@ IN TXT "v=spf1 mx include:_spf.example.net -all"SPF: allow the domain's MX hosts and a provider's list, fail everything else
-all / ~all / ?all / +allQualifiers: fail, softfail, neutral, pass; + is the default when none is written
10 DNS-querying termsinclude, a, mx, ptr, exists and redirect count; going over gives permerror
One SPF record per nameTwo v=spf1 TXT records on one name is an error, not a merge
sel1._domainkey IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBg..."DKIM public key published under selector sel1
_dmarc IN TXT "v=DMARC1; p=none; rua=mailto:[email protected]"DMARC in monitoring mode, sending aggregate reports
_dmarc IN TXT "v=DMARC1; p=reject; t=y"RFC 9989 test mode: publish reject but ask receivers not to enforce it yet
dig example.comQuery the A record through your system resolver with full verbose output
dig +short example.com MXPrint only the answer data, one record per line
dig +noall +answer example.com AAAAHide everything except the answer section, keeping names and TTLs
dig @1.1.1.1 example.com TXTAsk a specific resolver instead of the one in resolv.conf
dig -x 192.0.2.94Reverse lookup; dig builds 94.2.0.192.in-addr.arpa and asks for PTR
dig +trace example.comFollow the delegation from the root servers down, showing each referral
dig +nssearch example.comAsk each authoritative server for its SOA, to spot a server with a stale serial
dig +ttlunits example.comShow TTLs as 1h, 5m and so on instead of raw seconds
dns.lookup() goes through the operating system, including /etc/hosts. The resolve* functions always send real DNS queries, which is what you want when debugging records.
await resolver.resolve4('example.com', { ttl: true })A records with the remaining TTL for each address
await resolver.resolveSoa('example.com')SOA as an object with serial, refresh, retry, expire and minttl
await resolver.resolveCaa('google.com')CAA records as objects like { critical: 0, issue: 'pki.goog' }
await resolver.reverse('1.1.1.1')PTR lookup; returned ['one.one.one.one'] when we ran it
resolver.setServers(['1.1.1.1'])Point one Resolver instance at a chosen DNS server
Worked example: Check how a domain says 'I send no mail'
A domain that never sends mail should still publish records, or spammers can forge it freely. We checked example.com with a short Node script (Node 24.4.0, resolver 1.1.1.1):
import dns from 'node:dns/promises';
const r = new dns.Resolver(); r.setServers(['1.1.1.1']);
console.log(await r.resolveMx('example.com'));
console.log(await r.resolveTxt('example.com'));
console.log(await r.resolveTxt('_dmarc.example.com'));
Captured output on 28 Nov 2026:
[{"exchange":"","priority":0}]
[["v=spf1 -all"],["_k2n1y4vw3qtb4skdx9e7dxt97qrmmq9"]]
[["v=DMARC1;p=reject;sp=reject;adkim=s;aspf=s"]]
Read it in three layers. The MX with priority 0 and an empty exchange is a null MX (0 . in zone syntax), so senders know not to try delivering mail there. The SPF record v=spf1 -all has no mechanisms before -all, so no server is allowed to send as this domain. The DMARC record then tells receivers to reject anything that fails, for the domain and its subdomains, with strict alignment for both DKIM and SPF. The second TXT string is an unrelated verification token; it doesn't start with v=spf1, so SPF checkers ignore it. Copy this trio onto your own parked domains, using the SPF and DMARC generators if you prefer a form.
Common mistakes
Putting a CNAME on the bare domain so it follows a hosting provider's name.
The apex must carry SOA and NS, and a CNAME can't share a name with anything. Use A/AAAA records, or your DNS host's own flattening feature.
Adding a second
v=spf1TXT record for a new email provider.Merge the providers into one record with extra
include:terms, and keep the total of DNS-querying terms at 10 or fewer.Creating a record right after testing the name and assuming propagation is broken.
Your resolver cached the earlier NXDOMAIN for the SOA's negative TTL. Query the authoritative server with
dig @ns1... nameto see the truth, then wait it out.Lowering a TTL from 86400 to 300 an hour before a migration.
Resolvers that fetched the old record keep it for up to a day. Lower the TTL at least one old-TTL period before the move.
Pointing an MX record at a name that is itself a CNAME.
RFC 2181 forbids it and some senders refuse to deliver. Point MX at a name with its own A or AAAA records.
Still using
pct=10to roll out DMARC gradually.RFC 9989 removed
pct. Usep=nonewith reports first, thent=ywith the stricter policy while you watch the email header analyzer results.
Related cheat sheets
Sources
- https://www.rfc-editor.org/rfc/rfc1035.txt
- https://www.rfc-editor.org/rfc/rfc2181.txt
- https://www.rfc-editor.org/rfc/rfc2308.txt
- https://www.rfc-editor.org/rfc/rfc3596.txt
- https://www.rfc-editor.org/rfc/rfc2782.txt
- https://www.rfc-editor.org/rfc/rfc7208.txt
- https://www.rfc-editor.org/rfc/rfc6376.txt
- https://www.rfc-editor.org/rfc/rfc9989.txt
- https://www.rfc-editor.org/rfc/rfc8659.txt
- https://www.rfc-editor.org/rfc/rfc7505.txt
- https://datatracker.ietf.org/doc/rfc7489/
- https://bind9.readthedocs.io/en/stable/manpages.html
- https://nodejs.org/api/dns.html
How we research: where our facts come from, how often we re-check them, and why no one can pay for a review or a verdict.