[DNS Fundamentals Part 11] DNS Troubleshooting: Isolation Steps, Common Failures, and a Series Wrap-Up

DNS Fundamentals Part 11 DNS Troubleshooting: Isolation Steps, Common Failures, and a Series Wrap-Up DNS

“Something seems to be wrong with DNS.”

Reports of failures usually begin with this one line. But “something is wrong with DNS” could mean the client’s cache, the company’s caching DNS, or a configuration mistake on the authoritative DNS. If you try things at random without deciding where to start, it only takes longer.

Through Part 10 we have covered how DNS works, how to run it, how to investigate it, how to protect it, and how to use it in the cloud. In Part 11 we use that knowledge to put together a procedure for isolating DNS failures, and sort out the common failure patterns and the commands to check them. At the end, you will also find a quick-reference table and takeaways for the whole series.

▶ This part is also available as a YouTube video (about 19 min) (it is also embedded at the end of this article).


The isolation steps

The basic approach to isolating a DNS problem is to check in the order client → caching DNS → authoritative DNS → delegation, changing whom you ask one stage at a time.

Diagram of four stages: the client (hosts and cache), the caching DNS, the authoritative DNS (ns1 and ns2 queried one by one), and the parent zones (delegation), checked in turn with getent ahosts/resolvectl, dig @caching-DNS, dig @NS +norec, and dig +trace, showing that the further upstream the problem, the wider its impact
StageWhat to checkExample commandsWhat it tells you
0 Pin down the symptomWho, from where, which name, since when, the exact error message—Whether it affects everyone or only some, and whether it is a name resolution problem at all
1 ClientWhich DNS it uses, hosts, search domains, the client’s cache, VPN and DoHresolvectl status, ipconfig /all, getent ahosts nameWhether the problem is limited to that client
2 Caching DNSAsk it for the same name directly. Response code, EDE, remaining TTLdig @caching-DNS name, Resolve-DnsName name -Server caching-DNSWhat is in the cache, and why a SERVFAIL occurred
3 Authoritative DNSAsk every NS without recursion and compare. SOA serialdig @NS name +norec, Resolve-DnsName name -NoRecursion -Server NSWhether the configuration itself is right, and differences between NSs
4 DelegationFollow NS and DS from the parent downdig +trace name (in PowerShell, query from the parent’s NS with -NoRecursion, step by step)Breaks in delegation, lame delegation

The key point is that the cause lies at the boundary between the stage where the answer is correct and the stage where it goes wrong. The further upstream the problem, the wider its impact: a client problem affects only that client, while an authoritative DNS problem affects everyone who looks up that name.

The first step, “pin down the symptom,” matters too. Whether “nobody can resolve it” or “only some people can” changes completely where you should look.

Also, dig does not go through hosts or nsswitch; it asks the DNS you specify directly (Part 8). When “dig resolves it but the application fails,” try the same path as the OS: getent ahosts on Linux, or Resolve-DnsName on Windows.

The approach of “pin down the symptom, change whom you ask at each stage, and look for the boundary between the correct stage and the wrong one” applies just as well to troubleshooting email and certificates.


Common failure 1: A change doesn’t take effect

This is the most frequent complaint. There are mainly four causes.

Two timelines: when the TTL has not run out, the pre-change answer keeps being returned until it reaches 0; when the name is queried before the record is created, NXDOMAIN is cached for min(SOA TTL, MINIMUM), so the record exists but still returns NXDOMAIN

1. The TTL has not run out
A caching DNS server keeps returning the old answer until the TTL expires. If you ask the caching DNS directly, the remaining TTL in seconds tells you when it will expire.

$ dig @192.0.2.53 www.example.com A +noall +answer
www.example.com.		2873	IN	A	198.51.100.10

PS> Resolve-DnsName www.example.com -Server 192.0.2.53 -DnsOnly   # TTL column shows 2873

In this example, the answer will change to the new one in 2873 seconds (about 48 minutes).

2. Negative caching
If someone looks up a name before you create the record, NXDOMAIN is cached for the smaller of the SOA TTL and MINIMUM (RFC 2308, Part 3). This is the classic “I created it but it won’t resolve.”

3. Forgetting to increment the serial
With products where you edit a zone file, the zone is not transferred to the secondaries unless you increment the SOA serial (Part 7). Compare the SOA on each NS.

4. Editing the wrong place
If the registrar’s NS records point to a different DNS service, the zone you edited is not being used. Use dig +trace to confirm where the delegation really points. This one is surprisingly common.

When you are in a hurry, flush just that name from your own caching DNS.

  • BIND: rndc flushname name
  • Unbound: unbound-control flush name
  • Windows: Clear-DnsServerCache (the whole cache)

Keep in mind that caches on clients (ipconfig /flushdns, resolvectl flush-caches) and in applications (such as Java) may remain.


Common failure 2: Only some users or locations can’t resolve it

First, sort by “which caching DNS do the affected people use?” The internal DNS, a branch’s DNS, a VPN, and a home or smartphone connection each have a different cache state and a different path.

Diagram showing the caching DNS at HQ, the branch, and VPN/home each querying ns1 and ns2 with different serials and ns3, an old service that holds no zone, with four causes (NS mismatch, lame delegation, cache differences, path differences) and the commands to check them

1. Mismatch between NSs
A secondary is not in sync, or one server still has old configuration. The answer changes depending on which NS you hit.

$ dig +nssearch example.com
SOA ns1.example.com. hostmaster.example.com. 2026092502 3600 900 1209600 3600 from server 192.0.2.53 in 3 ms.
SOA ns1.example.com. hostmaster.example.com. 2026092401 3600 900 1209600 3600 from server 198.51.100.53 in 12 ms.

In this example, it is obvious at a glance that only the server at 198.51.100.53 has an old serial. In PowerShell, use the script introduced in Part 8 that lists the SOA serial of every NS.

2. Lame delegation
Some of the NSs registered at the parent do not hold the zone (when asked with +norec, they return REFUSED or a response without aa). A leftover old NS after a DNS service migration is the typical case, and depending on which NS is hit, you get failures or delays.

3. Cache differences
Only the caching DNS servers that cache an old NS or an old answer fail. The telltale sign is that they recover one by one, starting from where the TTL has expired.

4. Path differences
Large responses (DNSSEC signatures, long TXT records) are dropped, fragments and all, by a firewall or VPN on a particular path. Compare with dig +bufsize=1232 and dig +tcp (-TcpOnly in PowerShell) (Part 4).


Common failure 3: SERVFAIL

SERVFAIL means “the caching DNS could not get an answer,” and the response code alone does not tell you why. Gather clues in the order EDE → +cd → +trace.

Flowchart: when SERVFAIL is returned, if an EDE is attached, go by its number to a family of causes; if not, check whether +cd gives NOERROR to decide whether it is a DNSSEC problem; if that fails too, use dig +trace to find where it stops
EDENameCommon cause
6DNSSEC BogusSignature validation failed
7Signature ExpiredThe signature expired (re-signing stopped)
9DNSKEY MissingNo key matches the parent’s DS (a failed key rollover or DNS service migration)
15 / 18Blocked / ProhibitedBlocked by policy, or refused by access control
22No Reachable AuthorityNone of the authoritative DNS servers can be reached
23Network ErrorAn error while communicating with the authoritative DNS
$ dig @1.1.1.1 dnssec-failed.org A
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 2359
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; EDE: 9 (DNSKEY Missing): (no SEP matching the DS found for dnssec-failed.org.)

(This is an example using a public test domain for trying out validation failures.)

  1. An EDE is attached → go by its number to a family of causes (6 to 12 are DNSSEC, 15 to 18 are policy, 22 and 23 mean the authoritative DNS cannot be reached)
  2. Adding +cd (no validation) gives NOERROR → a DNSSEC problem. Confirm with delv (Part 8)
  3. Still can’t tell → use dig +trace to find where it stops. An unresponsive authoritative DNS or a lame delegation

PowerShell cannot show the EDE, so use Resolve-DnsName -DnssecCd to check whether an answer comes back.


Common failure 4: Reverse lookups, and names that fail only on the internal network

SymptomMain causeCheckFix
SSH login is slow by several to tens of secondsThe server does a reverse lookup on the source and waits for a timeout (UseDNS yes, etc.)dig -x source-IP, Resolve-DnsName source-IPRegister the PTR record. UseDNS defaults to no in OpenSSH 6.8 and later
Names do not appear, or do not match, in logs or allow-list settingsThe PTR is missing, or forward and reverse lookups do not matchdig -x (Resolve-DnsName IP), then forward-look up the resultRegister forward and reverse records so they match
Internal names fail only while on VPNThe VPN’s DNS settings, or a missing split-DNS settingresolvectl status, Get-DnsClientNrptPolicySpecify the internal domain and DNS in the settings the VPN distributes
Only certain internal domains failA conditional forwarder is not configured, or its target is downdig @forwarding-target name, Resolve-DnsName name -Server forwarding-targetUse two or more forwarding targets and monitor them
Resolves from outside but not from insideWith split horizon, a record was never added to the internal zoneCompare the same name on the internal and external DNSInclude both zones in the procedure for adding records (Part 7)
Only the browser can’t resolve internal namesThe browser’s DoH bypasses the internal DNSThe browser settings; compare with digControl DoH through corporate policy (Part 9)
Diagram showing that a slow SSH login is caused by the SSH server waiting for the PTR answer for the client, and that internal names failing only on VPN happens because queries for corp.example.com are not routed to the VPN side and the home router is asked instead

It helps to remember that slowness comes from waiting on a reverse lookup, and VPN problems depend on where queries are routed; this speeds up isolation.

As a side note, if you don’t create reverse zones for internal IP addresses (such as 10.0.0.0/8) on your internal DNS, queries leak to the internet, and things slow down by the time spent waiting for the answers (see Part 6 for how to write reverse zones).


Causes and check commands at a glance

Here is everything so far in one table. It is handy to keep nearby during an incident.

CauseVisible symptomCheck commandsDetails
The TTL has not run outThe pre-change answer is returneddig @caching-DNS name (remaining TTL), Resolve-DnsName -ServerPart 3
Negative cachingNXDOMAIN even though the record was createdThe SOA and TTL in the AUTHORITY section of dig (in PowerShell, the SOA whose Section column is Authority)Part 3
Secondary not in syncThe answer differs by NSdig +nssearch zone, Resolve-DnsName zone -Type SOA -Server each-NSPart 7
Lame delegationSometimes slow or failingdig +trace, dig @NS name +norec (is aa set?), -NoRecursionPart 2
DNSSEC validation failureSERVFAIL, but succeeds with +cddig +cd, delv, EDE, Resolve-DnsName -DnssecCdPart 9
Large responses droppedOnly TXT or DNSKEY failsdig +bufsize=1232, dig +tcp, Resolve-DnsName -TcpOnlyPart 4
No reverse recordSSH is slow, logs show only the IPdig -x IP-address, Resolve-DnsName IP-addressPart 6
Forwarding or VPN misconfiguredOnly internal names failresolvectl status, Get-DnsClientNrptPolicy, dig @forwarding-targetParts 3 and 10

Series wrap-up: key points of each part at a glance

Let’s look back over the whole series. When you are in trouble, use this table to go back to the relevant part.

PartThemeKey pointsWhen you use it
Parts 1–2The big picture; hierarchy and delegationThe three key players, zones and delegation, internal names as subdomains of a domain you ownThe start of a design (Part 12, Question 1)
Parts 3–4How name resolution works; messagesTTL and negative caching, forwarding, TCP is mandatory, EDNS at 1232Change work (Part 12, Question 2)
Parts 5–6Resource recordsCNAME constraints, MX and SPF/DKIM/DMARC, CAA, HTTPSReviewing zones (Part 12, Question 5)
Part 7Running authoritative DNSSerials and zone transfers, TTL change procedure, split horizonMigrations, moving DNS services
Part 8Investigating with commandsReading dig and Resolve-DnsName, @ / +norec / +trace, response patternsEvery investigation
Part 9SecurityDNSSEC and SERVFAIL, takeover, encrypted DNSAudits (Part 12, Question 5)
Part 10Cloud and corporate networksVPC Resolver and endpoints, AD’s SRV records, ndotsHybrid setups (Part 12, Question 3)
Part 11TroubleshootingClient → caching DNS → authoritative DNS, EDEIncident response (Part 12, Question 4)

In every part, it is easier to understand things if you keep in mind “which DNS am I asking, and what?“


Three things to take away

Diagram of three takeaways: 1. whom you are asking (client, caching DNS, and authoritative DNS, checked one stage at a time with dig @), 2. plan changes around TTL and caches (TTL 86400 to 300, keep the old environment), 3. names are assets (domain renewal, unused CNAMEs, email authentication, DNSSEC)

1. Be aware of whom you are asking right now
Separate the stub resolver, caching DNS, and authoritative DNS, and check one stage at a time with dig @server (Resolve-DnsName -Server on Windows).

2. Plan DNS changes on the assumption of TTLs and caches
Lower the TTL beforehand, keep the old environment, and don’t forget negative caching and the serial.

3. Manage names as assets
Make internal names subdomains of a domain you own, and periodically take inventory of domain renewals, unused records, email authentication, and DNSSEC.

When in doubt, go back to “which DNS am I asking, and what?” As a first step, run dig +trace on your own PC and follow the delegation of a name you use every day.

References

  • RFCs: 1034 and 1035 (basics), 2181 (clarifications), 2308 (negative caching), 6891 (EDNS), 7766 and 9210 (TCP), 4033 to 4035 (DNSSEC), 8914 (EDE), 9156 (QNAME minimization), 9460 (SVCB/HTTPS), 9499 (terminology). Japanese translations are available in JPRS’s “DNS-related technical information” (a Japanese-language resource)
  • Official documentation: the BIND 9 Administrator Reference Manual (ISC), the Unbound documentation (NLnet Labs), Microsoft Learn (DNS in Windows Server, AD DS design), the Amazon Route 53 Developer Guide, the Azure DNS documentation, and Kubernetes’ “DNS for Services and Pods”

Summary

  • Isolate in the order client → caching DNS → authoritative DNS → delegation. The cause lies at the boundary between the correct stage and the wrong one
  • For “the change isn’t taking effect,” suspect these four: TTL, negative caching, serial, and where you edited
  • For “only some users,” sort by which caching DNS the affected people use
  • For SERVFAIL, gather clues in the order EDE → +cd → +trace
  • Slowness points to reverse lookups; VPN problems point to where queries are routed

Next time is the final part. Using everything you have learned so far, you will work through five design exercises.


Watch the video

This part is also explained in a YouTube video (about 19 min).

All parts of the series are in the DNS Fundamentals playlist on YouTube.

The DNS Fundamentals series (12 parts)

All 12 parts with a reading guide: DNS Fundamentals

  1. What Is DNS? How Name Resolution Works and Its Three Key Players
  2. The domain name hierarchy and delegation
  3. How name resolution works
  4. DNS messages and transport
  5. Resource records, part 1
  6. Resource records, part 2
  7. Running authoritative DNS servers
  8. Investigating with commands
  9. DNS security
  10. DNS in the cloud and on corporate networks
  11. DNS troubleshooting (this article)
  12. DNS design exercises

This series is the English edition of 【DNS入門】, originally written in Japanese.

コメント

Copied title and URL