GrepBoard/Manuals
605 manuals ·

New DNS Record Not Resolving? NXDOMAIN Negative Caching

·Tested on Ubuntu 24.04 · BIND 9.18.39 · Unbound 1.19.2 · DiG 9.18.39 (Docker) · 2026-10·Test scope ↓·6 steps

New DNS record still NXDOMAIN? Ask the authoritative server with dig +norecurse. If it's there, the resolver cached the NXDOMAIN; wait out the SOA TTL.

output
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 28773example.com.		52	IN	SOA	ns1.example.com. hostmaster.example.com. 2026102701 3600 600 86400 60

If anyone looked up the name before the record existed — including you, checking whether it was live yet — the resolver cached the "does not exist" answer (NXDOMAIN). It keeps saying the name doesn't exist after you create the record, until that cache entry expires. If the authoritative server has the record, your DNS change is fine; the second field of the SOA line in the resolver's AUTHORITY section (52 above) is the seconds left. Wait that long or flush the resolver cache.

[1] Find the domain's authoritative servers and ask them directly. With +norecurse, an aa in flags means the answer came from an authoritative server.

console
$ dig example.com NS +shorthera.ns.cloudflare.com.elliott.ns.cloudflare.com.$ dig @elliott.ns.cloudflare.com www.example.com A +norecurse +noall +comments +answer | grep -E "status|flags|IN";; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9014;; flags: qr aa; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1; EDNS: version: 0, flags:; udp: 1232www.example.com.	300	IN	A	104.20.23.154www.example.com.	300	IN	A	172.66.147.243

For your own domain, run the same two commands with your names. If this also says NXDOMAIN, the problem is the record, not a cache: it went into another zone (a typo, or www added twice), the change wasn't saved in the DNS provider's dashboard, or the registrar points to a different provider's nameservers. Start by checking that the names from NS +short belong to the provider where you created the record. If the authoritative server returns REFUSED, that provider doesn't have the zone — see dig status: REFUSED.

If dig +short prints only a CNAME and no address, query again without +short and read status:; NXDOMAIN there can mean the CNAME target does not exist — see dig +short shows a CNAME but the name is NXDOMAIN.

[2] With several nameservers, compare the SOA serial on each. When you edit zone files yourself (BIND and the like) and don't bump the serial, secondaries don't pick up the new zone.

console
$ dig @127.0.0.1 -p 5353 example.com SOA +norecurse +shortns1.example.com. hostmaster.example.com. 2026102702 3600 600 86400 60

The third field is the serial. Repeat with @ set to each server from NS +short; a different value means a secondary still has the old zone.

[3] Confirm the resolver's negative cache. Here, a test BIND (authoritative, port 5353) with Unbound in front of it (resolver, port 53) was asked the same name before and after the record was created:

console
$ dig @127.0.0.1 new.example.com A…;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 49163…;; AUTHORITY SECTION:example.com.		60	IN	SOA	ns1.example.com. hostmaster.example.com. 2026102701 3600 600 86400 60

Then new IN A 192.0.2.81 was added, the serial bumped, and the zone reloaded. The authoritative server answered right away:

output
;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 2…new.example.com.	60	IN	A	192.0.2.81

Asking the resolver at the same moment gave the block at the top of this page: still NXDOMAIN, the SOA carrying the old serial (…01), and the TTL down from 60 to 52 — the answer came from cache. After 60 seconds the new record came through:

console
$ dig @127.0.0.1 new.example.com A +noall +comments +answer | grep -E 'status|IN';; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55127new.example.com.	60	IN	A	192.0.2.81

[4] Work out how long to wait from the SOA. RFC 2308 sets the TTL of a negative answer to the smaller of the SOA's MINIMUM field (the last number) and the TTL of the SOA record itself. The test zone had an SOA TTL of 3600 and a MINIMUM of 60, so the resolver cached it for 60 seconds.

console
$ dig @elliott.ns.cloudflare.com example.com SOA +norecurse +noall +comments +answer | grep -E "flags|SOA";; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1…example.com.		1800	IN	SOA	elliott.ns.cloudflare.com. dns.cloudflare.com. 2418004112 10000 2400 604800 1800

For this zone both values are 1800, so a "does not exist" answer can stick for up to 30 minutes. RFC 2308 says negative caching times of one to three hours have worked well and that values over a day have caused problems. A zone where you create names often can use a shorter MINIMUM. Changing it does not shorten negative answers that are already cached; they keep the old TTL. If your DNS provider fixes the SOA values, you can't change it at all.

[5] If you changed the value of an existing record, the delay is that record's TTL, not negative caching. Right after www was changed from 192.0.2.80 to .82 in the test, the resolver still returned the old value with 52 seconds left:

output
www.example.com.	52	IN	A	192.0.2.80

Once the TTL ran out, 192.0.2.82 came back. When you plan to move an address, lower that record's TTL about a day ahead (say 3600 to 300), let the old TTL expire once, then change the value, and raise the TTL again afterwards.

[6] If you can't wait, flush whichever cache holds the answer. Caches stack up in resolvers, the OS and the browser, and each one is flushed separately.

Where the cache isHow to flush
Your own BINDrndc flushname new.example.com
Your own Unboundunbound-control flush new.example.com; negative answers only: unbound-control flush_negative
Google Public DNS (8.8.8.8)The official Flush Cache page (developers.google.com/speed/public-dns/cache); it says to flush the parent domain first
Cloudflare (1.1.1.1)Cloudflare's 1.1.1.1 purge cache tool
Linux clientFlush the DNS cache on Linux

You can't flush a corporate or ISP resolver, so wait for the TTL there. Checking lookups can seed a fresh negative entry in that resolver too, so don't query the name before the record exists.

Check it with the dig output explainer tool ↗ — calculated in your browser.

#dns#ttl#negative-cache#nxdomain#soa#dig