Insights

DNS Queries Hang Instead of Returning SERVFAIL? Trace the Authoritative Path With dig +trace

November 12, 2026
0:00
You run dig example.com and nothing comes back. No SERVFAIL, no NXDOMAIN, no answer at all. The command just sits there for 15 seconds, then prints connection timed out; no servers could be reached. Meanwhile, every service that depends on that domain name — your app's API calls, outbound email, webhook deliveries — stalls and queues up behind the same silent timeout. A clean error would at least let retry logic kick in fast. A hang is worse than a failure. This guide walks through exactly how to trace the authoritative delegation path with dig +trace and packet captures to find which nameserver is silently dropping your queries.
Before chasing authoritative servers, rule out your own resolver. By default, dig uses whatever nameservers are listed in /etc/resolv.conf. If that resolver is dead or unreachable, every query hangs regardless of the target domain. Test against a known-good public resolver:
BASH
# Query Cloudflare's resolver directly
dig @1.1.1.1 example.com A +time=5 +tries=1

# Query Google's resolver directly
dig @8.8.8.8 example.com A +time=5 +tries=1
Three outcomes matter here:
  • Both return an answer quickly. Your local resolver in /etc/resolv.conf is the problem. Fix that and move on.
  • Both return SERVFAIL quickly. The authoritative side is broken, but at least the failure is explicit. The public resolvers tried the delegation, got something wrong, and told you.
  • Both hang or time out. The authoritative nameservers for that zone are silently dropping queries. This is the scenario worth tracing.
If only one public resolver hangs and the other answers, you might be hitting a routing or anycast issue specific to that resolver's path to the authoritative server. That narrows the problem but still needs tracing.
dig +trace bypasses your local resolver entirely. It starts at the root nameservers, follows the referrals down through TLD servers, and queries each authoritative nameserver it finds along the way. This lets you see exactly where the chain breaks.
BASH
dig +trace +time=5 +tries=1 example.com A
The +time=5 flag sets a 5-second timeout per query, and +tries=1 prevents retries so you don't wait forever at a broken step. Default dig behavior (typically 5-second timeout with 3 tries) means a single broken nameserver can stall you for 15 seconds per server. Read the output in sections. Each section represents one level of the DNS hierarchy:
  1. Root servers (.) — You get a referral to the TLD servers (e.g., .com nameservers). If this step hangs, your machine cannot reach root servers at all, which is a fundamental network problem.
  2. TLD servers (e.g., .com) — You get a referral listing the authoritative nameservers for the domain. The NS records and any glue records (IP addresses embedded in the referral) appear here. If the TLD responds but lists nameservers that don't exist or point to wrong IPs, the next step fails.
  3. Authoritative nameservers — This is where the answer (or the hang) lives. dig +trace tries each NS record it received from the TLD.
What you're looking for: the trace proceeds normally through root and TLD, then stalls or produces no output at the authoritative step. Note which specific nameserver IP it was trying when it stopped. That's your culprit. If the authoritative step returns a referral to yet another set of nameservers (a delegation to a subdomain's own NS records), the problem might be one more level down. Follow it manually:
BASH
dig @<delegated-ns-ip> subdomain.example.com A +time=5 +tries=1
Replace <delegated-ns-ip> with the IP from the referral.
A nameserver that is completely offline typically triggers a TCP RST or ICMP port-unreachable message, and dig returns connection refused relatively fast. A nameserver that hangs is different — it accepts the packet (or at least doesn't reject it) but never sends a response. This pattern often comes from:
  • A firewall or security group that allows inbound port 53 but the DNS daemon behind it is misconfigured or crashed, so the packet enters a black hole.
  • A DNS server that receives the query but enters an internal loop trying to resolve something it depends on (broken forwarding config, circular delegation).
  • An anycast IP where some nodes are healthy and others are not, so queries intermittently succeed or hang depending on which node your packets reach.
  • An automation or configuration change that left the zone in a broken state — the server is running but cannot serve that specific zone, and instead of returning SERVFAIL, it simply doesn't respond.
To confirm packets are leaving your machine and not getting responses, use a packet capture. On Linux:
BASH
# Capture DNS traffic to/from a specific nameserver IP
# Run this in one terminal, then run your dig command in another
tcpdump -nn -i any host <nameserver-ip> and port 53
You'll see outbound query packets. If you see your query go out but no response comes back, the remote side is dropping it. If you see no packets at all, something local (firewall, routing) is blocking the outbound query. For a quick reachability check without tcpdump, test whether the nameserver responds to a simple SOA query:
BASH
dig @<nameserver-ip> example.com SOA +time=3 +tries=1
If SOA works but your specific record type hangs, the server is up but has a problem serving that particular query — possibly a broken zone file or a DNSSEC signing issue that causes it to loop internally.
Domains typically have two or more NS records. One might be healthy while another hangs. Resolvers pick nameservers somewhat randomly or based on past response times, so intermittent hangs — the kind that drive you crazy because "it works sometimes" — often mean one NS is broken and the others are fine. Get the NS list from the TLD:
BASH
dig +short example.com NS
Then query each one individually:
BASH
dig @ns1.example.com example.com A +time=5 +tries=1
dig @ns2.example.com example.com A +time=5 +tries=1
If ns1 answers and ns2 hangs, you found the broken server. The fix depends on who controls that nameserver — update the NS records at the registrar to remove the broken one, or fix the server itself. A related pattern: the NS records at the TLD level (the delegation) don't match the NS records the authoritative server returns (the zone's own NS RRset). This mismatch — sometimes called a "lame delegation" — can cause resolvers to chase nameservers that don't actually serve the zone. Those servers might respond with REFUSED, or they might just drop the query.
Sometimes the hanging nameserver belongs to a third-party DNS provider or a domain you don't control. Your application calls an API at api.vendor.com, their authoritative DNS is broken, and your app hangs waiting for resolution. Short-term mitigations:
  • Lower your resolver's timeout. If you run your own recursive resolver (BIND, Unbound, PowerDNS Recursor), reduce the query timeout so it returns SERVFAIL faster instead of waiting the full default period. For Unbound, the directive is serve-expired: yes combined with a shorter jostle-timeout. For BIND, resolver-query-timeout controls this. Check your resolver's documentation for exact syntax.
  • Cache aggressively. If the domain resolved successfully before, a resolver with serve-stale (RFC 8767) capability can keep returning the cached answer even after TTL expiry, buying time during an upstream outage.
  • Set application-level DNS timeouts. Most HTTP client libraries let you set a DNS resolution timeout separately from the connection timeout. Use it. A 2-second DNS timeout with a fast retry to a secondary resolver is better than a 30-second hang.
If you manage DNS for your own domain and notice that queries to your authoritative servers hang, check whether a recent zone change, DNSSEC key rotation, or automation script broke the zone. The pattern described in the research context — where an internal infrastructure change causes a subset of authoritative queries to hang rather than fail fast — is exactly this scenario. The fix is reverting the change or correcting the zone, not tweaking resolver behavior. For context on how DNS failures cascade beyond just "slow website," the dynamics are covered in DNS Outage Cascading to API and Cloud Services. And if you recently migrated DNS and suspect stale cached records are part of the picture, Lowered DNS TTL Before Migration, but Visitors Still Hit the Old Server covers that angle.
A DNS query that hangs is harder to debug than one that fails, because there's no error message to search for. The method is always the same: isolate whether the problem is your resolver or the authoritative path (dig @1.1.1.1), walk the delegation to find which level breaks (dig +trace), test each nameserver individually, and confirm packet-level behavior with tcpdump when the answer isn't obvious. Once you know which server is dropping queries, you either fix it, remove it from the NS set, or protect your applications with shorter timeouts and stale-cache serving.

Join My Newsletter & Get Updates!

Get notified whenever a new technical guide, server infrastructure breakdown, or personal reflection goes live, plus a curated weekly digest.