Start with what clients actually receive
unknown host, Name or service not known, or a connection timeout to an unexpected address look similar in a log, but they come from different DNS outcomes. Query the same recursive resolver your services use, from the same network segment, and look at the status line and the answer section.
Four outcomes are worth telling apart:
- SERVFAIL means the resolver could not get a usable answer.
- NXDOMAIN means the name does not exist.
- NOERROR with an empty answer section, usually called NODATA, means the name exists but has no record of the type you asked for.
- NOERROR with an address means the resolver returned something. You still need to check whether that address is right and how fresh it is.
Ask the authoritative servers directly
BASH
# What the resolver your services use returns
dig @10.0.0.53 db.internal.example.com A
# What each authoritative server returns, with no recursion
dig @ns1.example.com db.internal.example.com A +norecurse
dig @ns2.example.com db.internal.example.com A +norecurseWhy serve-stale only covers some kinds of blank
0.0.0.0 are all valid responses. The resolver caches them and hands them to every client. Negative answers are cached for a period derived from the zone's SOA record, as described in RFC 2308. No resolver setting rescues you in this case. The fix belongs in the publishing pipeline.
So when someone says serve-stale saved them during a blank-record incident, or failed to save them, first ask what the authoritative servers were returning.
How serve-stale hides the problem it protects you from
serve-expired-client-timeout set, it first waits that long for a fresh answer, which is closer to the RFC 8767 behavior. A capped configuration looks like this (the values are an illustrative example):
TEXT
server:
serve-expired: yes
# stop serving expired data one day after it expires (seconds)
serve-expired-ttl: 86400
# wait up to 1.8 s for a fresh answer before using stale data (milliseconds)
serve-expired-client-timeout: 1800unbound-control get_option serve-expired. Defaults for these options have changed across Unbound versions, so check the documentation for your version instead of assuming. BIND 9 has equivalent options (stale-answer-enable, max-stale-ttl, stale-answer-client-timeout), and rndc serve-stale status shows whether the feature is active. Other resolvers use different names, so look up the exact options for the one you run.
