Skip to content

Menu

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.

Why a new record seems missingLooking up a name before it exists caches the NXDOMAIN for the negative TTL, so the resolver keeps saying no after you create the record.You test the name firstthe record doesn't exist yetResolver gets NXDOMAINcached for min(SOA TTL, SOA MINIMUM)You create the recordResolver still answers NXDOMAINuntil the cached answer expiresdig @ns1... namethe authoritative server shows the truth
Looking up a name before it exists caches the NXDOMAIN for the negative TTL, so the resolver keeps saying no after you create the record.

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.10

IPv4 address for a host name, cached for an hour

Try it: DNS Record GeneratorFrom the docs, not run by us
www 3600 IN AAAA 2001:db8::10

IPv6 address for the same name; publish both if the server has both

From the docs, not run by us
blog 3600 IN CNAME example.github.io.

Make blog an alias of another name; blog may then have no other records

From the docs, not run by us
@ 3600 IN MX 10 mail.example.com.

Mail for the domain goes to mail.example.com; lower preference numbers are tried first

From the docs, not run by us
@ IN MX 0 .

Null MX: the domain accepts no mail at all (RFC 7505)

From the docs, not run by us
@ 86400 IN NS ns1.example.net.

Delegate the zone to a name server; MX and NS targets must not be CNAMEs

From the docs, not run by us
@ 3600 IN TXT "v=spf1 mx -all"

Free-text record; each quoted string is at most 255 characters

From the docs, not run by us
_sip._tcp 3600 IN SRV 10 60 5060 sip.example.com.

Service location: priority, weight, port, target

From the docs, not run by us
@ 3600 IN CAA 0 issue "ca1.example.net"

Only the named CA may issue certificates for this domain; issuewild covers wildcards

From the docs, not run by us
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

From the docs, not run by us
CNAME + anything else on the same name

Not allowed: a name with a CNAME can have no other data (DNSSEC records aside)

From the docs, not run by us
MX / NS target that is a CNAME

Not allowed: the value of an MX or NS record must be a canonical name

From the docs, not run by us
TTL 0 to 2147483647

Valid TTL range in seconds (2^31 - 1); 0 means do not cache

From the docs, not run by us
Label <= 63 octets, name <= 255 octets

Hard length limits; long DKIM or verification names can hit them

From the docs, not run by us
Several PTR records for one IP

Allowed: RFC 2181 says no rule limits a name to a single PTR

From the docs, not run by us

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 300

Zone start: primary server, contact mailbox, serial, refresh, retry, expire, negative TTL

From the docs, not run by us
NXDOMAIN

The name does not exist at all; cached for min(SOA TTL, SOA MINIMUM)

From the docs, not run by us
NODATA (NOERROR, empty answer)

The name exists but has no record of the type you asked for; cached the same way

From the docs, not run by us
SOA MINIMUM

Now means the negative-caching TTL; the old 'minimum TTL for the zone' meaning is deprecated

From the docs, not run by us

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

Try it: spf-record-generatorFrom the docs, not run by us
-all / ~all / ?all / +all

Qualifiers: fail, softfail, neutral, pass; + is the default when none is written

From the docs, not run by us
10 DNS-querying terms

include, a, mx, ptr, exists and redirect count; going over gives permerror

From the docs, not run by us
One SPF record per name

Two v=spf1 TXT records on one name is an error, not a merge

From the docs, not run by us
sel1._domainkey IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBg..."

DKIM public key published under selector sel1

Try it: dkim-record-generatorFrom the docs, not run by us
_dmarc IN TXT "v=DMARC1; p=none; rua=mailto:[email protected]"

DMARC in monitoring mode, sending aggregate reports

Try it: dmarc-record-generatorFrom the docs, not run by us
_dmarc IN TXT "v=DMARC1; p=reject; t=y"

RFC 9989 test mode: publish reject but ask receivers not to enforce it yet

From the docs, not run by us
dig example.com

Query the A record through your system resolver with full verbose output

Try it: DNS LookupFrom the docs, not run by us
dig +short example.com MX

Print only the answer data, one record per line

From the docs, not run by us
dig +noall +answer example.com AAAA

Hide everything except the answer section, keeping names and TTLs

From the docs, not run by us
dig @1.1.1.1 example.com TXT

Ask a specific resolver instead of the one in resolv.conf

From the docs, not run by us
dig -x 192.0.2.94

Reverse lookup; dig builds 94.2.0.192.in-addr.arpa and asks for PTR

From the docs, not run by us
dig +trace example.com

Follow the delegation from the root servers down, showing each referral

From the docs, not run by us
dig +nssearch example.com

Ask each authoritative server for its SOA, to spot a server with a stale serial

From the docs, not run by us
dig +ttlunits example.com

Show TTLs as 1h, 5m and so on instead of raw seconds

From the docs, not run by us

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=spf1 TXT 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... name to 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=10 to roll out DMARC gradually.

    RFC 9989 removed pct. Use p=none with reports first, then t=y with the stricter policy while you watch the email header analyzer results.