Every DNS lookup on a Linux host takes exactly 5 seconds before succeeding.
IntermediateTroubleshootingDNS resolution failures
Answer
Likely causes → The first nameserver in resolv.conf is dead and glibc waits timeout:5 before trying the next, or AAAA queries are dropped (parallel A/AAAA issue).
Diagnose →
cat /etc/resolv.conf
for ns in $(awk '/^nameserver/{print $2}' /etc/resolv.conf); do dig @$ns example.com +time=2 +tries=1 | grep 'Query time'; done
strace -f -e trace=network getent hosts example.com 2>&1 | head -40
Fix → Remove the dead server. Add options timeout:1 attempts:2 rotate while you fix the root cause, or single-request-reopen for the A/AAAA case.
Prevent → Monitor each resolver individually.
More on DNS resolution failures
`dig app.example.com` returns `status: NXDOMAIN`.Beginner`dig` returns `status: SERVFAIL` for one domain while other domains resolve fine.Intermediate`curl: (6) Could not resolve host: api.example.com` inside a container but it resolves on the host.BeginnerA DNS change was made 2 hours ago, but some users still reach the old IP.BeginnerJava service keeps connecting to an old IP long after the DNS record changed.IntermediateIn Kubernetes, external lookups from pods are slow and CoreDNS logs show many NXDOMAIN queries like `api.stripe.com.default.svc.cluster.local`.Intermediate