brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: dig status and the SOA line tell NXDOMAIN and empty answers apart

Dig
~/tips/tip-dig-nxdomain-nodata-soa

dig nope.iana.org @9.9.9.9 | grep -E 'status|SOA'

Read whether a name does not exist or just lacks that record type, and how long resolvers cache the miss.

“No answer” in DNS comes in two kinds, and dig shows which one you got in the header. The SOA record that comes with it tells you how long that miss stays cached.

dig nope.iana.org @9.9.9.9 | grep -E 'status|SOA'
dig iana.org AAAA @9.9.9.9 +noall +comments +authority

status: NXDOMAIN means the name does not exist at all, for any type. status: NOERROR with ANSWER: 0 is called NODATA: the name exists, it just has no record of the type you asked for. That difference matters. An NXDOMAIN for a host you just created points at a typo or the wrong zone, while NODATA means you only need to add the missing type.

Both come with the zone’s SOA record in the authority section, for example iana.org. 1211 IN SOA sns.dns.icann.org. .... Per RFC 2308, resolvers cache the negative answer for the lower of the SOA’s own TTL and its last field, the minimum. That number explains why a record you add can stay invisible for a while: a resolver that asked before you added it keeps saying no until the timer runs out.

I’d keep that negative TTL low on zones that change often. Some resolvers also cap it to their own maximum, so the real wait can be shorter. And +short hides all of this, which is why I’d drop it whenever an answer is empty.

Further reading: dig manual (BIND 9), RFC 2308: negative caching of DNS queries

Going deeper: Guide: dig for beginners, look up DNS records and read the answer

More Dig tips dig +noall +answer DS example.com dig +search nas dig @8.8.8.8 www.google.com +subnet=203.0.113.0/24 dig +yaml example.com A dig +short +identify example.com @9.9.9.9 All Dig tips (36) All topics

Link