Resolver timeouts: what to check first
“Everything is slow” is usually “DNS is slow”. Before changing resolvers, find out which step is timing out — the query, the connection, or the answer.
Measure the resolution, not the browser
dig +stats example.com @127.0.0.53
dig +tcp example.com @127.0.0.53
dig +dnssec example.com @1.1.1.1
Compare UDP and TCP answers. UDP working while TCP times out points at a firewall that drops 53/tcp; both failing points at the resolver itself or the network in front of it.
The three usual causes
- Systemd-resolved and a hand-written resolv.conf. The stub at 127.0.0.53 answers, but the upstream list is empty or stale. Check
resolvectl status, not just the file. - A resolver reachable only over IPv6. The host has no working v6 route and every lookup waits for the v6 attempt to expire. Test with
dig -4anddig -6. - DNSSEC validation against a broken upstream. SERVFAIL on signed zones only — the resolver is validating and the upstream is lying. Compare with
+cd(checking disabled).
Fix the timeout, then the cache
A short timeout masks a broken resolver for months: the first query fails, the retry succeeds, and users call it “a bit slow”. Set a realistic timeout (2–3 s), enable a local cache, and watch the SERVFAIL rate. If the rate is non-zero, you have a bug, not a performance problem.