Why a New Subdomain Still Does Not Resolve After Adding a DNS Record: Negative DNS Caching

Image

 Earlier in the day, someone tried to open

shop.example.com, which did not yet exist in DNS, and receivedNXDOMAIN. A few minutes later, the administrator added this record:

shop.example.com. 300 IN A 203.0.113.20

The authoritative DNS server now returns the new address, butdig shop.example.com Aand the browser still report that the name does not exist. Rather than assuming that DNS changes are still propagating, find out which server is returning the old response.


Why DNS Keeps Returning NXDOMAIN

A recursive DNS resolver may have queried the name before the record was created. At that point, the authoritative server correctly returnedNXDOMAIN, and the resolver cached the negative response. This is negative DNS caching. Resolvers cache negative answers as well as positive ones and can store the fact that a name or a particular record type does not exist. Until the cached response expires, the resolver may continue returning it without contacting the authoritative servers.

The new subdomain may already point to a VPS with a public IP address, and the web server may be configured to handle requests for the correctHost. Yet some users will never reach HTTP because their resolver still returns the previously cachedNXDOMAIN.

NXDOMAINmeans that the DNS name itself does not exist. It is a valid negative response, not a temporary failure such asSERVFAIL,REFUSEDor a timeout. Start by identifying the exact DNS response and which server supplied it.

Check Delegation and Every Authoritative DNS Server

Do not begin by clearing the browser cache. First, identify the servers responsible for the zone:

dig example.com NS +short
dig +trace shop.example.com A

The first command shows the NS records visible to the resolver being used. The+traceoption follows the delegation chain from the root servers and helps identify the nameservers specified by the parent zone.

This matters when someone edits DNS records at an old provider even though the domain has already been delegated elsewhere. In that situation, the new record has simply been published in the wrong zone.

Once you have identified the actual authoritative servers, query each one directly with recursion disabled:

dig @ns1.example-dns.net shop.example.com A +norecurse
dig @ns2.example-dns.net shop.example.com A +norecurse
dig @ns3.example-dns.net shop.example.com A +norecurse

For a newAAAAorCNAME, query the corresponding record type. Examine the responsestatus, the Answer section, theaaflag (authoritative answer) and whether all servers return the same data.

If the first nameserver returns the newArecord while the second still returns an authoritativeNXDOMAIN, the problem is still with zone publication. A recursive resolver querying the second server may receive another negative response and cache it again.

It is also useful to compare SOA records:

dig @ns1.example-dns.net example.com SOA +norecurse
dig @ns2.example-dns.net example.com SOA +norecurse

Different SOA serial numbers often indicate a delayed update in a traditional primary/secondary DNS configuration. Identical serial numbers, however, do not guarantee identical zone contents across every server operated by a modern DNS provider.

The decisive test is the response from each nameserver actually delegated for the domain. Only when all of them consistently return the new record should you investigate an oldNXDOMAINin a recursive resolver's cache.

Where Negative TTL Comes From and Why SOA Matters

Under RFC 2308, an authoritative server includes the zone's SOA record in the Authority section of a negativeNXDOMAINorNODATAresponse.

The SOA record contains zone parameters, including theMINIMUMfield, which is used to calculate the caching lifetime of negative responses. In modern DNS, it does not mean the minimum TTL of everyA,AAAAandCNAMErecord in the zone.

An illustrative response for a non-existent name might look like this:

;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN
;; flags: qr aa; ...
;; AUTHORITY SECTION:
example.com. 900 IN SOA ns1.example-dns.net. hostmaster.example.com. 2026110901 3600 600 1209600 1800

Suppose the zone's original SOA TTL is 900 seconds and its SOAMINIMUMis 1800 seconds. When constructing the negative response, the authoritative server uses the lower value, as specified by RFC 2308. The SOA record in the Authority section therefore receives a TTL of 900 seconds. This TTL determines how long the negative response may be cached. A recursive resolver may impose additional limits according to its own caching policy.

When the resolver serves the response from its cache, the TTL decreases. Once it reaches zero, the cachedNXDOMAINorNODATAresponse can no longer be used.

To inspect a negative response directly, query a test name known to be absent from a zone you control:

dig @ns1.example-dns.net missing.example.com A +norecurse

Checkstatus: NXDOMAIN, the Authority section and the SOA TTL. Do not assume that an arbitrary real domain name is guaranteed to be non-existent.

Why the New Record's TTL Does Not Shorten an Old NXDOMAIN

Suppose a resolver receivesNXDOMAINat 10:00 with a negative TTL of 1800 seconds. At 10:01, the administrator publishes:

shop.example.com. 60 IN A 203.0.113.20

The TTL of60applies to the positive response the resolver will receive after querying the authoritative DNS again. It does not invalidate the negative response already in the cache.

If the cached response is still valid, the resolver has no knowledge of the new record. It can continue returningNXDOMAINuntil the remaining negative TTL expires or the resolver operator explicitly clears the entry.

Changing SOA settings afterwards does not clear someone else's cache either. If a resolver has already cachedNXDOMAINfor 3600 seconds and the administrator subsequently reduces SOAMINIMUMto 300, the new value affects newly generated negative responses.

An existing cached response does not automatically adopt the shorter lifetime. The resolver may not contact the authoritative server again until the original TTL expires.

For that reason, publishing a record with a TTL of 60 seconds does not guarantee that the subdomain will become accessible within a minute. The familiar explanation that DNS propagation takes 24–48 hours is equally imprecise. The actual delay depends on the previous negative TTL, the state of the authoritative servers and the resolver chain involved.

Compare Responses from Specific Recursive Resolvers

On a server with administrative access to DNS tools, you can examine the authoritative DNS separately from the recursive resolver used by the application.

On Linux, start with:

resolvectl status
cat /etc/resolv.conf

An address such as127.0.0.53often indicates the localsystemd-resolvedstub, which forwards requests to upstream DNS servers. Identify not only the address listed in/etc/resolv.conf, but also the upstream resolvers actually used for that DNS query.

On systems with VPNs, multiple network interfaces or split DNS routing, different names may be resolved through different servers.

Query the relevant resolver directly and compare its response with an authoritative answer:

dig @192.0.2.53 shop.example.com A
dig @ns1.example-dns.net shop.example.com A +norecurse

For comparison, you can also query other recursive resolvers:

dig @1.1.1.1 shop.example.com A
dig @8.8.8.8 shop.example.com A

These commands are for diagnosis, not a recommendation to change users' DNS settings.

If every authoritative nameserver returns203.0.113.20, one recursive resolver still returnsNXDOMAIN, and another already returns the new address, the first resolver's negative cache is a likely cause.

Its Authority section may contain an SOA record with a decreasing TTL, perhaps742on one query and515later. A falling TTL supports the conclusion that the resolver is serving a cached negative response, although forwarding between resolvers, TTL limits and implementation details can complicate the picture.

If the authoritative servers return different results, fix that inconsistency first. If all of them returnNXDOMAIN, the record has not yet been published in the active authoritative zone.

A successful result from one public DNS checker does not show what a particular customer's resolver is returning.

NXDOMAIN and NODATA Are Cached Differently

NXDOMAINmeans the requested DNS name does not exist.NODATAmeans the name exists, but no record of the requested type is available.

For example,shop.example.commay have anArecord but noAAAArecord. A query forAAAAcan then returnstatus: NOERROR, an empty Answer section and an SOA record in the Authority section. This does not mean the name itself is absent.

RFC 2308 distinguishes the cache keys used for these negative responses.

ForNXDOMAIN, the key is<QNAME, QCLASS>. The negative response concerns the name regardless of the requested record type.

ForNODATA, the key is<QNAME, QTYPE, QCLASS>. A cached absence ofAAAAdoes not prevent the resolver from returning an existingArecord.

When adding newAAAA,MX,TXTorCNAMErecords, this distinction determines which earlier negative response may still be cached.

There is another behaviour described in RFC 8020, known as NXDOMAIN cut. A resolver that has cached the non-existence ofshop.example.commay also returnNXDOMAINfor a descendant such aswww.shop.example.comwithout making a separate authoritative DNS query.

This behaviour applies to the non-existent subtree until the relevant negative cache expires. Whether it occurs depends on the resolver implementation.

Do Not Confuse Browser, Operating System and ISP Caches

A browser may have its own DNS cache or use DNS-over-HTTPS. The operating system may contact a local stub, which in turn queries a corporate DNS server, a VPN resolver or the ISP's recursive resolver.

A browser error saying that a website cannot be found does not identify which layer is holding the oldNXDOMAIN.

If necessary, the local cache can be cleared. On Windows:

ipconfig /flushdns

On Linux systems usingsystemd-resolved:

resolvectl flush-caches

Neither command clears the cache of an external recursive resolver. If that resolver still holdsNXDOMAIN, clearing the local cache simply causes the computer to retrieve the same negative response again.

Other DNS services require their own diagnostic and cache-clearing methods. There is no single command that applies to every Linux DNS configuration.

Switching one client to another recursive resolver may temporarily bypass the cached response. It does not resolve the problem for users who continue to use the original resolver.

When Negative Caching Is No Longer the Cause

If a direct DNS query through the resolver in use returns the correctAorAAAArecord, but the browser reports404,502, a TLS certificate error orconnection refused, investigate the web server, virtual host, firewall, proxy, certificate and application.

DNS resolution and HTTP availability are separate stages.

If the response isSERVFAILrather thanNXDOMAIN, the investigation also changes. Check delegation, authoritative server availability, DNSSEC validation and failures within the resolver itself.

RFC 9520 covers the caching of DNS resolution failures, including temporary failures. This is separate from the negative caching ofNXDOMAINandNODATAresponses whose TTL is derived from SOA.

Do not treat every DNS failure as a staleNXDOMAINcache problem.

Worked Example: The Record Exists, but NXDOMAIN Remains Cached

At 10:00, a user queriesapi.example.com A. The name does not yet exist. The authoritative server returnsNXDOMAINwith a negative TTL of 1800 seconds, and the recursive resolver caches the response.

At 10:05, the administrator creates:

api.example.com. 300 IN A 203.0.113.20

By 10:06, a direct authoritative query succeeds:

dig @ns1.example-dns.net api.example.com A +norecurse

However, the resolver that received the negative response at 10:00 still returnsNXDOMAIN:

dig @192.0.2.53 api.example.com A

The SOA record in its Authority section may show a remaining TTL of approximately 1440 seconds.

Another resolver that queries the name for the first time after 10:05 receives the new address immediately.

When the first resolver's negative cache expires, it queries the authoritative DNS again and also begins returning203.0.113.20.

Nothing on the web server has changed during this period. This is an illustrative example, not an actual Era.Host incident.

How to Confirm the Fix and Prepare for the Next Launch

First, check delegation and every authoritative nameserver:

dig +trace api.example.com A
dig @ns1.example-dns.net api.example.com A +norecurse
dig @ns2.example-dns.net api.example.com A +norecurse

Compare theaaflag, record contents, response status, delegation and, where appropriate, SOA data.

Then check the recursive resolvers actually being used:

dig @192.0.2.53 api.example.com A
dig @1.1.1.1 api.example.com A

If one resolver still returnsNXDOMAIN, inspect the SOA record and remaining TTL, then repeat the query after it expires. A successful response from one public resolver is not sufficient confirmation for every client.

Once the required DNS record resolves correctly, perform a separate application check:

curl -I https://api.example.com/

When preparing new hostnames, account for the possibility that applications, monitoring systems, automated checks and users may query them before publication.

If your DNS provider allows you to control negative TTL through SOA, reduce it in advance, allowing the previous value to expire before the planned launch. Changing it after an oldNXDOMAINhas already been cached will not invalidate existing responses.

Keeping negative TTL extremely low at all times is not advisable either: repeated queries for non-existent names will increase the load on authoritative DNS servers.

The problem is resolved when every active authoritative DNS server publishes the correct record, the resolvers used by clients have stopped returning the old negative response, and the application is accessible under its new hostname.

There is no universal need to wait 24–48 hours. The task is to identify where the response comes from and how long that particular cache remains valid.

Image
Previous Post Next Post