DNS lookup without the cache

· 4 min read

You changed a record and your machine still shows the old value? Then a cache is answering: the browser, the operating system, the router or your ISP. This guide shows how to bypass all of them and ask the source, how dig +trace exposes the whole delegation chain, and how to flush the caches you control.

Ask the source directly

The only answer that involves no cache at all comes from one of the domain's authoritative name servers. Everything else is a copy with an expiry time. Pick your tool and approach:

What to check
Tool

Only inserted into the commands in your browser.

Ask the authoritative server · dig · Linux, macOS

The first line lists the domain's name servers, the second asks one of them directly (replace ns1.example.net with a name from the first answer). The aa flag means authoritative answer, no cache involved. The TTL shows its full value.

Shell
dig +short NS example.com
dig +norecurse A example.com @ns1.example.net
Sample output
;; flags: qr aa; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; ANSWER SECTION:
example.com.		300	IN	A	192.0.2.10

Ask the authoritative server · nslookup · Windows, Linux, macOS

The name server goes last. If the line "Non-authoritative answer" is missing from the reply, it came straight from the source.

Shell
nslookup -type=NS example.com
nslookup -type=A example.com ns1.example.net
Sample output
Server:		ns1.example.net
Address:	192.0.2.53#53

Name:	example.com
Address: 192.0.2.10

Ask the authoritative server · PowerShell · Windows

-Server asks the given name server instead of the Windows resolver, -DnsOnly switches off LLMNR and NetBIOS, -NoHostsFile skips the hosts file. That keeps the local cache out of the picture.

PowerShell
Resolve-DnsName -Name example.com -Type NS -DnsOnly
Resolve-DnsName -Name example.com -Type A -Server ns1.example.net -DnsOnly -NoHostsFile

Compare public resolvers · dig · Linux, macOS

Cloudflare, Google and Quad9 in turn. The second column is the remaining TTL: 121 means this resolver keeps serving its stored copy for another 121 seconds before it asks again.

Shell
dig +noall +answer A example.com @1.1.1.1
dig +noall +answer A example.com @8.8.8.8
dig +noall +answer A example.com @9.9.9.9
Sample output
example.com.		121	IN	A	192.0.2.10
example.com.		300	IN	A	192.0.2.10
example.com.		103	IN	A	192.0.2.10

Compare public resolvers · nslookup · Windows, Linux, macOS

nslookup does not show the TTL. You see which value a resolver returns right now, but not for how much longer.

Shell
nslookup -type=A example.com 1.1.1.1
nslookup -type=A example.com 8.8.8.8
nslookup -type=A example.com 9.9.9.9
Sample output
Server:		1.1.1.1
Address:	1.1.1.1#53

Non-authoritative answer:
Name:	example.com
Address: 192.0.2.10

Compare public resolvers · PowerShell · Windows

The TTL column in the output is the remaining TTL at the resolver you asked.

PowerShell
Resolve-DnsName -Name example.com -Type A -Server 1.1.1.1 -DnsOnly
Resolve-DnsName -Name example.com -Type A -Server 8.8.8.8 -DnsOnly
Resolve-DnsName -Name example.com -Type A -Server 9.9.9.9 -DnsOnly

If the source returns the right answer, the change is saved correctly. Whatever stale data public resolvers still hand out disappears when the TTL expires; you cannot speed that up from outside.

dig +trace: the full chain from the root

With +trace dig behaves like a resolver itself: it starts at the root servers, gets referred to the TLD servers and from there to the domain's name servers. Caches play no part. +nodnssec keeps the output readable.

Shell
$ dig +trace +nodnssec A example.com

.			518400	IN	NS	a.root-servers.net.
;; Received 239 bytes from 192.0.2.53#53(192.0.2.53) in 21 ms

com.			172800	IN	NS	a.gtld-servers.net.
;; Received 836 bytes from 198.41.0.4#53(a.root-servers.net) in 42 ms

example.com.		172800	IN	NS	ns1.example.net.
example.com.		172800	IN	NS	ns2.example.net.
;; Received 359 bytes from 192.43.172.30#53(i.gtld-servers.net) in 39 ms

example.com.		300	IN	A	192.0.2.10
;; Received 72 bytes from 192.0.2.53#53(ns1.example.net) in 24 ms

The output is trimmed to one line per level here. Read it from the bottom: the last "Received … from" line names the server that gave the final answer. The block above shows which name servers the registry lists for the domain. If those are still the old ones, the name server change never reached the registrar.

If +trace stops with "connection timed out; no servers could be reached", your router does not hand out the root server list. Name a public resolver for the first step: dig +trace A example.com @1.1.1.1.

Flush the local caches

When the source has the new value but your machine does not, clear the operating system cache. The next lookup is fresh, though it still goes through your router and ISP, which cache on their own.

Shell
# Windows (Command Prompt or PowerShell)
ipconfig /flushdns
Clear-DnsClientCache

# macOS
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

# Linux with systemd-resolved
sudo resolvectl flush-caches

On Windows both commands do the same thing. Browsers keep a cache of their own; a private window or a browser restart gets around it. A home router usually only forgets on reboot, so for testing it is easier to name a different resolver.

Test the website before DNS has moved

A server migration often needs the opposite: reach the new server while DNS still points at the old one. curl can override name resolution for a single request, no hosts file needed.

Shell
curl -sI --resolve example.com:443:192.0.2.10 https://example.com

The request goes to 192.0.2.10 but sends the real host name, so certificate and virtual host match. If nothing answers at that address, curl gives up after the timeout with exit code 28.

What the results tell you

Typical pictures and their causes:

  • Source new, resolver old: caching; the remaining TTL in dig's output says for how long. Lower the TTL in good time before the next migration.
  • The name servers disagree: the secondary has not picked up the zone yet. Compare the serial number in the SOA record of both servers.
  • Status REFUSED from a name server: it does not host the zone. The domain is delegated to servers where it is not (or no longer) configured.
  • +trace ends at the old name servers: the delegation at the registry is unchanged; the switch was not saved at the registrar or is still being processed.
  • New value everywhere except the office: an internal DNS server with its own zone for the domain (split DNS), common in Windows domains.
  • NXDOMAIN sticks: "does not exist" is cached too, for the smaller of two values, the TTL of the SOA record and its last field (minimum), as RFC 2308 defines.

Checking without a terminal

The DNS propagation checker runs this comparison in one step: it reads the authoritative name servers and asks twelve public resolvers whether they already return the same value. Planning the TTL ahead of a move is covered in the DNS migration guide.

Frequently asked questions

How do I query DNS without a cache answering?
Ask one of the domain's authoritative name servers directly: dig A example.com @ns1.example.net or nslookup example.com ns1.example.net. dig +short NS example.com lists the name servers.
What does dig +trace do?
dig resolves the name itself, starting at the root servers, and prints every referral. The final answer comes straight from the authoritative server; no resolver cache is involved.
Is ipconfig /flushdns enough to see a DNS change immediately?
Only if the stale value sat in the Windows cache. Routers and ISPs have caches you cannot clear. For verification, querying the name server directly is more reliable.
How long does a DNS change take to reach everyone?
As long as the TTL of the old record, counted from the change. With 3600 seconds that is at most an hour. The often-quoted 24 to 48 hours apply to name server changes, because the delegation at the registry carries long TTLs.
Check now

Check DNS propagation for free: which resolvers worldwide (Google, Cloudflare, Quad9 …) already return the new A, MX or TXT record, which still the old one?

DomainWarn stores the DNS records of all client domains and reports every change with a before-and-after diff, read straight from the authoritative name servers.

Monitor this domain continuously14-day free trial, no credit card.

More guides