When DNS Lies: TTL, Propagation, Resolver Caching and Debugging with dig

Your website is down. Except it is not down. It loads fine on your phone, fails on your laptop, and your client in another country sees a completely different error. You check the server. The server is fine.

This is almost always DNS. And the worst part is that DNS lies to you while you debug it, because every layer between you and the authoritative nameserver keeps its own copy of the truth, each with its own expiry timer.

The lie: "DNS hasn't propagated yet"

Propagation is real, but it is rarely the actual problem. When you change a DNS record, the authoritative nameserver has the new value immediately. What you are waiting for is not propagation. It is caches expiring.

The chain looks like this:

your browser -> OS stub resolver -> recursive resolver (ISP / 1.1.1.1 / 8.8.8.8) -> authoritative nameserver -> the real record 

Every step in that chain can serve a stale answer until the record's TTL (time to live) expires. A record with a TTL of 86400 seconds can look "not propagated" for a full day, even though nothing is broken.

Start at the source: query the authoritative server

When something looks wrong, never start with your local resolver. Start with the server that owns the zone:

dig @ns1.yourprovider.com example.com +short 

If the authoritative answer is correct, your DNS change is live. Everything after that is caching.

Compare it against public resolvers:

dig @1.1.1.1 example.com +short dig @8.8.8.8 example.com +short 

If Cloudflare and Google disagree, one of them is still holding the old record. Wait out the TTL. Do not "fix" it by changing the record again, you will only reset the confusion.

Read the TTL, not just the answer

dig example.com +noall +answer 

Output:

example.com. 300 IN A 203.0.113.10 

That 300 is the remaining TTL in seconds. If it says 300, the answer expires in 5 minutes. If it says 86300, someone cached it for a day and you are waiting until tomorrow. The TTL in the answer tells you exactly how long the lie will last.

Trace the full path when you suspect a delegation problem:

dig example.com +trace 

This shows every hop from the root servers down to your authoritative nameserver. A wrong NS record at the registrar or a stale delegation shows up here immediately.

The four caches that betray you

1. Negative caching. A failed lookup is also cached. If you queried a record before it existed, the NXDOMAIN answer can be cached for minutes or hours, and the correct record will keep failing until that negative TTL expires. Check it:

dig nonexistent.example.com 

If you see status: NXDOMAIN with a TTL in the AUTHORITY SECTION, that failure is cached. There is nothing to fix on the server side. Wait it out.

2. The OS resolver cache. On modern Ubuntu, systemd-resolved caches answers:

resolvectl flush-caches 

On older systems:

sudo systemd-resolve --flush-caches 

3. The browser cache. Chrome and Firefox cache DNS independently of the OS. In Chrome, open chrome://net-internals/#dns and clear the host cache. Otherwise you can flush everything on the machine and the browser will still show the old site.

4. /etc/hosts. The oldest trap in the book. A forgotten entry in /etc/hosts overrides DNS completely, and dig will not show it because dig queries DNS directly, bypassing the hosts file. When dig says one thing and the browser says another, check:

grep example.com /etc/hosts 

A debugging workflow that actually works

  1. Query the authoritative server first. If it is wrong, fix the zone and stop.
  2. Query two public resolvers. If they disagree, it is caching. Read the remaining TTL.
  3. Check the record type you actually changed. A missing www A record is not a propagation problem, it is a missing record.
  4. Check MX and TXT separately when mail breaks. Web working does not mean mail works:
dig example.com MX +short dig example.com TXT +short 
  1. Flush the local caches, then the browser cache, then test again.
  2. Check /etc/hosts before you blame the network.

The one habit that prevents all of this

Before any migration, lower the TTL 24 to 48 hours in advance:

example.com. 300 IN A 203.0.113.10 

A 300 second TTL means a bad change is reversible in five minutes, and a good change is visible everywhere in five minutes. The default TTL of 86400 is the reason a typo can ruin your whole day.

DNS does not lie on purpose. It just remembers the past for exactly as long as you told it to. The TTL is the contract. Read it before you panic.

What is the strangest DNS issue you have debugged? I read every comment.