schedule 14-min read

DNS Lookup Fundamentals for MSPs: Checking Email Authentication Records

DMARC AI editorial team · Last updated

How MSP engineers look up SPF, DKIM, DMARC, MX, PTR, MTA-STS and BIMI records with dig, nslookup and Resolve-DnsName, and read TTLs and NXDOMAIN.

01

How do MSP engineers look up email authentication records?

A DNS lookup for email authentication means querying specific names: TXT at the domain for SPF, TXT at _dmarc for DMARC, TXT (often via CNAME) at selector._domainkey for DKIM, plus MX, PTR, _mta-sts, _smtp._tls, default._bimi and _report._dmarc. Use dig, nslookup or Resolve-DnsName, compare resolvers, and read the status code as carefully as the answer.

Every DMARC engagement begins and ends with DNS lookups, and most "DMARC isn't working" tickets turn out to be DNS tickets: the wrong resolver was queried, a cached answer was still live, or a TXT record was split badly.

This article is the DNS companion to the DMARC pillar and the DMARC for MSPs practice page, and a working reference for our DNS Lookup tool.

02

Key takeaways

  • Know the exact owner name for each record: SPF lives at the domain apex, DMARC at _dmarc.<domain>, DKIM at <selector>._domainkey.<domain>, MTA-STS at _mta-sts, TLS-RPT at _smtp._tls.
  • Read the response code. NXDOMAIN (name does not exist) and NODATA (name exists, no record of that type) mean different things to SPF and to DMARC's np= tag.
  • "Propagation" is cache expiry. The TTL on the old record, and the SOA values for negative answers, tell you how long stale results can persist.
  • Confirm a change at the authoritative server first (dig @ns, +trace), then at two unrelated public resolvers.
  • Run the same lookup set on every client domain at onboarding, after every change and on a fixed schedule.
03

Which records and names does an email authentication lookup cover?

An email authentication audit touches about a dozen DNS names per domain. Each protocol uses a fixed owner name and record type, so the first skill is querying the right name. Most problems come from querying the apex when the record lives under an underscore label, or the reverse.

What you are checking Name to query Type What a good answer starts with
SPF example.com TXT v=spf1
DMARC _dmarc.example.com TXT v=DMARC1
DKIM public key selector1._domainkey.example.com TXT (often reached via CNAME) v=DKIM1 or k=rsa; p=
Inbound mail routing example.com MX priority and host name
Reverse DNS of a sending IP 4.3.2.1.in-addr.arpa PTR a host name that resolves back to the IP
MTA-STS _mta-sts.example.com TXT v=STSv1; id=
TLS reporting _smtp._tls.example.com TXT v=TLSRPTv1
BIMI default._bimi.example.com TXT v=BIMI1
External report authorisation example.com._report._dmarc.reports.example.net TXT v=DMARC1

SPF must be a TXT record (RFC 7208 section 3.1), and more than one v=spf1 record at a name is a permerror (section 4.5), hence the frequent need for merging multiple SPF records.

DMARC is found by prefixing _dmarc to the domain. Under RFC 9989, records not starting with the DMARC version tag are discarded, and if several valid records come back for one name, all are discarded. With nothing at the exact name, receivers use the DNS tree walk to find the organisational domain's record.

DKIM selectors cannot be discovered from DNS. Take them from the s= tag in a signed header or the platform console; see DKIM selectors explained.

MX and PTR sit upstream of authentication: see MX records and email authentication and reverse DNS (PTR) and email authentication. _report._dmarc records let a third-party domain accept a client's reports, as described in section 3 of RFC 9990 and in authorising external DMARC report destinations.

04

How do you run the lookups with dig, nslookup and Resolve-DnsName?

All three tools send the same DNS query; they differ in output format. dig (Linux, macOS, WSL) shows the full response including status and flags. nslookup ships with Windows and is quick but terse. Resolve-DnsName is the PowerShell cmdlet and returns objects you can filter and export across a client list.

dig

# DMARC policy, short output
dig +short TXT _dmarc.example.com

# Full response, so you can read status, flags and TTL
dig TXT _dmarc.example.com

# DKIM selector (follows a CNAME automatically)
dig TXT selector1._domainkey.example.com

# MX, MTA-STS, TLS-RPT, BIMI
dig +short MX example.com
dig +short TXT _mta-sts.example.com
dig +short TXT _smtp._tls.example.com
dig +short TXT default._bimi.example.com

# Reverse DNS for a sending IP
dig +short -x 203.0.113.25

In the full output, look at three places. The header line status: NOERROR or status: NXDOMAIN is the response code. The flags: line shows aa when the answer came from an authoritative server, and rd ra when a recursive resolver answered. The second column of each answer line is the remaining TTL in seconds.

nslookup

nslookup -type=TXT _dmarc.example.com
nslookup -type=MX example.com
nslookup -type=TXT _dmarc.example.com 8.8.8.8

The third form queries a specific resolver. "Non-authoritative answer" only means a recursive resolver answered, not that the record is wrong. "Non-existent domain" indicates NXDOMAIN.

Resolve-DnsName

Microsoft Learn documents Resolve-DnsName with -Type for the record type, -Server to choose the DNS server, -DnsOnly to skip LLMNR and NetBIOS, -NoHostsFile, -CacheOnly and -NoRecursion.

Resolve-DnsName -Name _dmarc.example.com -Type TXT -DnsOnly
Resolve-DnsName -Name example.com -Type MX -Server 1.1.1.1
Resolve-DnsName -Name selector1._domainkey.example.com -Type TXT -Server 8.8.8.8

# Portfolio check: DMARC for every domain in a CSV
Import-Csv .client-domains.csv | ForEach-Object {
  Resolve-DnsName -Name "_dmarc.$($_.Domain)" -Type TXT -DnsOnly -ErrorAction SilentlyContinue |
    Where-Object Type -eq 'TXT' |
    Select-Object @{n='Domain';e={$_.Name}}, TTL, @{n='Record';e={$_.Strings -join ''}}
}

The Strings property holds the TXT record's individual character-strings, hence the join.

05

What do TTLs and caching mean for record changes?

A TTL (time to live) is how long a resolver may cache an answer. RFC 1034 defines it as a time limit on how long a record can be kept in a cache, set by the zone administrator. "Propagation" is really resolvers waiting for their cached copy to expire.

The practical consequences:

  • The authority has the new value as soon as the zone is published. The wait is at resolvers that cached the old answer.
  • Lower the TTL before a planned change. If a DMARC policy step is due next week, drop the _dmarc TTL to 300 seconds now, then restore it afterwards.
  • Re-querying the same resolver proves nothing. It serves its cached copy until expiry; the counting-down TTL in dig's answer tells you how long.
  • Negative answers are cached too. RFC 2308 section 5 says the TTL for a cached NXDOMAIN or NODATA answer is the minimum of the SOA record's MINIMUM field and the SOA's own TTL. If someone checked _dmarc before you published it, their resolver may report "no record" for that long.

When a client says the record "hasn't propagated", ask them to query 1.1.1.1 or 8.8.8.8 directly. If those show the new value, the remaining delay is their own resolver's cache.

06

How do you tell an authoritative answer from a recursive one?

An authoritative answer comes from a name server that hosts the zone; RFC 1035 section 4.1.1 defines the AA flag as meaning the responding server is an authority for the name. A recursive answer comes from a resolver and may be cached. Check the authority first, then the resolvers.

# Find the authoritative servers
dig +short NS example.com

# Ask one of them directly, without recursion
dig @ns1.example-dns.net TXT _dmarc.example.com +norecurse

# Walk the delegation from the root down
dig +trace TXT _dmarc.example.com

If the aa flag is present and the record is right, any remaining problem is caching. If the authority returns the old value, the change was never published, or was published at the wrong provider: common after a migration where someone edited the old provider's zone. dig +trace shows which name servers the delegation really points at. The SOA serial (dig +short SOA example.com) can confirm a republish, though some managed providers do not increment it predictably.

07

Why does the difference between NXDOMAIN and NODATA matter?

NXDOMAIN means the queried name does not exist at all. NODATA means the name exists but has no record of the requested type; RFC 2308 describes it as a NOERROR response with no relevant answers. SPF counts both as void lookups, but DMARC's np= tag treats only NXDOMAIN as non-existent.

In dig, the two look like this:

;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN   (name does not exist)
;; ->>HEADER<<- opcode: QUERY, status: NOERROR    (with ANSWER: 0 = NODATA)

Both responses normally carry the zone's SOA in the authority section, which is where the negative caching TTL comes from.

For SPF, RFC 7208 section 4.6.4 defines a void lookup as either a NOERROR answer with zero records or a Name Error (NXDOMAIN), and implementations should allow no more than two. Exceeding that returns permerror. An old include: pointing at a vendor that has since removed its SPF record is a typical cause. This sits alongside the 10-term DNS lookup limit covered in SPF too many DNS lookups.

For DMARC, RFC 9989 section 3.2.13 defines a non-existent domain by the NXDOMAIN response code, referring to RFC 8020. The np= tag sets the policy for non-existent subdomains of the organisational domain; if np is absent, sp applies, then p. A subdomain that exists only because it has, say, a TXT record returns NODATA for A or MX, so it is an existing subdomain and sp/p apply, not np. See non-existent subdomains and the DMARC np tag for policy examples.

SERVFAIL and timeouts give temperror for SPF (RFC 7208 section 4.4), and under RFC 9989 a message whose DMARC queries cannot complete neither passes nor fails. Fix intermittent SERVFAIL, often broken DNSSEC, at the authority.

08

How should you read a CNAME at _dmarc or a DKIM selector?

A CNAME aliases one name to another, and resolvers restart the query at the target when they meet one (RFC 1034 section 5.2.2). DKIM selectors are frequently CNAMEs to the sending platform, and some hosted DMARC services ask for a CNAME at _dmarc. Both work, provided the target returns a valid TXT record.

dig TXT selector1._domainkey.example.com
# selector1._domainkey.example.com. 3600 IN CNAME selector1-example-com._domainkey.provider.example.net.
# selector1-example-com._domainkey.provider.example.net. 3600 IN TXT "v=DKIM1; k=rsa; p=MIIBIjAN..."

What to check:

  • The chain ends in a TXT record. A CNAME whose target returns NXDOMAIN or NODATA is a missing key, typically because the platform has not yet activated DKIM for the tenant.
  • Nothing else sits at the same name. RFC 1034 section 3.6.2 says no other data should be present at a CNAME node, so a CNAME at _dmarc plus a leftover TXT record is broken.
  • You control the alias, not the content. With a CNAME at _dmarc, the policy can change outside the client's zone. Record that in the runbook and your change management policy.
09

How do TXT records longer than 255 characters work?

A single TXT character-string holds at most 255 octets, because RFC 1035 section 3.3 gives it a one-byte length prefix, and TXT data is one or more such strings. Longer values, typically 2048-bit DKIM keys or long SPF records, are published as several quoted strings that the verifier joins without adding spaces.

selector1._domainkey.example.com. 3600 IN TXT "v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA" "u3xVq...remainder-of-key...IDAQAB"

RFC 7208 section 3.3 states this for SPF: multiple strings are treated as one string with no spaces added. RFC 6376 applies the same approach to DKIM key records. On the wire the strings are always separate; dig shows them as separate quoted strings, and Resolve-DnsName returns them in the Strings array.

Errors to look for: a space added at the split (inc lude:), a control panel that silently truncates at 255 characters, and the halves published as two separate TXT records rather than two strings in one record, which breaks both SPF and DKIM.

10

When should you check with DNS-over-HTTPS?

DNS-over-HTTPS (DoH), standardised in RFC 8484, sends queries to a public resolver over HTTPS. It is useful when a corporate network intercepts or filters port 53, when you are on a locked-down jump host, or when you want to compare what major public resolvers see without changing local settings.

# Cloudflare 1.1.1.1 JSON API
curl -s -H "accept: application/dns-json" 
  "https://cloudflare-dns.com/dns-query?name=_dmarc.example.com&type=TXT"

# Google Public DNS JSON API
curl -s "https://dns.google/resolve?name=_dmarc.example.com&type=TXT"

In the JSON (Cloudflare, Google), Status is the response code (0 NOERROR, 2 SERVFAIL, 3 NXDOMAIN), Answer holds records with their TTL, and AD shows DNSSEC validation. Our DNS Lookup tool runs these DoH queries against several public resolvers in one view.

11

What does a DNS lookup routine look like across an MSP portfolio?

A repeatable routine runs the same lookup set at four points: onboarding, every change, every deliverability ticket and a fixed schedule. Each run records the answer, TTL and resolver in the client runbook, so drift shows up as a difference rather than a guess.

  1. Onboarding baseline. For each client domain, capture SPF, DMARC, every known DKIM selector, MX, NS, _mta-sts, _smtp._tls and default._bimi, plus PTR for each sending IP you control. Note TTLs and which DNS provider hosts the zone. This feeds the wider client domain audit.
  2. Every change. Lower the TTL in advance, publish, confirm with dig @ns that the authority has the new value, then confirm at two unrelated public resolvers. Paste the output into the change ticket.
  3. Every deliverability ticket. Re-query SPF, DMARC and the DKIM selector from the failing message's headers, and compare against the baseline. Differences are leads.
  4. Scheduled drift check. Monthly at minimum, re-run the lookups for every covered domain. Clients edit their own DNS, registrar moves revert zones, and vendors retire SPF includes, which creates new void lookups.

For UK public sector and regulated clients, the same baseline supports the evidence trail behind NCSC DMARC guidance.

When should you escalate beyond basic lookups?

Escalate when the authority returns intermittent SERVFAIL or its name servers disagree, when resolvers still differ well beyond the old TTL, or when DKIM fails although the key resolves. That last case usually means string splitting or a wrong selector.

12

Tools mentioned

13

FAQ

Why does dig show a different DMARC record from my DNS provider's control panel?

The control panel shows the zone as stored at the authority; dig shows what your resolver has cached. Query the authoritative server with dig @ns1.provider TXT _dmarc.example.com. If that matches the panel, the difference is caching and will clear when the old record's TTL expires.

Is a CNAME at _dmarc allowed?

Yes. Resolvers follow the CNAME and return the TXT record at its target, so receivers see the policy normally. No other record may exist at _dmarc alongside the CNAME, and the target must return exactly one valid v=DMARC1 record. Document who controls the target, because policy changes there bypass the client's zone.

Does a NODATA response count as a non-existent domain for the np tag?

No. RFC 9989 defines a non-existent domain by the NXDOMAIN response code. A name that exists but lacks the queried record type returns NOERROR with no answers, so sp or p applies to it instead. SPF is different: it counts both NODATA and NXDOMAIN as void lookups.

How long should I wait after changing an SPF or DMARC record?

Wait for the TTL of the old record as resolvers cached it, which you can read in dig's answer. If the record did not exist before, the negative caching time from the zone's SOA applies. Lowering the TTL a day or more before a planned change keeps the wait to minutes.

Which resolvers should I compare when verifying a change?

Start with the authoritative name server, then two unrelated public resolvers such as Cloudflare 1.1.1.1 and Google 8.8.8.8. Add the client's own resolver if users report the old behaviour. DoH queries let you compare public resolvers from networks that filter or intercept ordinary DNS traffic.

14

Next steps

Build the lookup set above into your onboarding template, run it against one client domain this week, and save the output as that client's baseline. Then make "authority first, then two resolvers" the required check on every DNS change ticket. Our DNS Lookup tool covers the quick checks; the RFCs linked above settle any argument about what a response means.

Author: DMARC AI editorial team Last updated: November 2026

Related articles

Related tools

Ready to Implement?

Get authenticated mail moving in minutes: start free, book a guided demo, or talk to the team about your stack.