Use it when names fail, resolve slowly or resolve to the wrong address.
DNS Troubleshooting
DNS troubleshooting on Linux separates where resolution fails: the application, nsswitch and /etc/hosts, the local stub, the upstream server, or the authoritative data.
1. getent hosts <name> — result?
2. dig <name> @<configured-server> — status (NOERROR/NXDOMAIN/SERVFAIL/timeout)?
3. Timeout → nc -vzu <server> 53 / firewall.
4. Wrong answer → /etc/hosts, resolvectl flush-caches, then the authoritative server: dig +trace <name>.
5. Short names fail → search domain.
application → nsswitch → hosts file → stub cache → upstream → authoritative answer
For DNS → DNS Troubleshooting, continue with the first unproven Topic check: Record exact query name/type, original application error, timestamp, network namespace/interface and whether short-name search expansion is involved. If that boundary is healthy, advance to the adjacent check: Compare getent/application lookup, resolvectl state/query and direct dig to the selected upstream while preserving A/AAAA and DNS view. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
dig @10.0.0.53 example.comVerification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
original application failure → resolver API/NSS → hosts/resolv.conf ownership → local stub/cache → selected upstream reachability → DNS RCODE/answer/TTL/view → address selection → original application retry
Healthy evidence: application-path lookup, resolver runtime state and upstream response agree on the intended answer and the original failure is no longer reproducible.
Step 2 Verification and output interpretation Verify boundary
Existing fast checks for this Topic. - Record exact query name/type, original application error, timestamp, network namespace/interface and whether short-name search expansion is involved.
- Compare getent/application lookup, resolvectl state/query and direct dig to the selected upstream while preserving A/AAAA and DNS view.
- Classify first failure as local policy/config, stub/cache, reachability, DNS protocol/response, wrong data/view or post-DNS endpoint failure.
- Make one minimal change, repeat the original application lookup, verify intended endpoint and test persistence across link/VPN/DHCP renewal when relevant.
Verification chain. original application failure → resolver API/NSS → hosts/resolv.conf ownership → local stub/cache → selected upstream reachability → DNS RCODE/answer/TTL/view → address selection → original application retry
Step 3 Commands Verify boundary
dig @10.0.0.53 example.com
resolvectl query example.com
tcpdump -ni any port 53
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: tools disagree, response codes indicate different failure classes, queries route to the wrong DNS view/server, or resolution is healthy but the application endpoint still fails.
Step 5 Common mistakes Narrow the fault
- Only testing one resolver.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Compare getent hosts (system path) with dig @<server> (direct). Timeouts point to network/firewall (UDP and TCP 53); NXDOMAIN to the name or search domain; wrong address to /etc/hosts, cache or stale records.
dig +trace <name>— follow delegation from the rootresolvectl status— DNS servers per link (systemd-resolved)cat /etc/resolv.conf— configured nameserversgetent hosts <name>— resolution through the system path (nsswitch)dig <name> @<server>— query a specific server
ReferenceWhat it is1 section · depth on demand
Core model
Start from the original failing name and exact time. Reproduce through the application path, then step outward: local hosts/NSS, resolver configuration, systemd-resolved or other stub, selected upstream server, DNS response code/data/TTL, then returned-address connectivity. Compare successful and failing paths rather than changing all resolver layers at once.
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
DNS troubleshooting is resolved only when the first failed resolver boundary is corrected and the original application lookup succeeds with the intended answer under the same network/view conditions; diagnostic-tool success alone is insufficient.
In depth
Which server answers for which link?
$ resolvectl status
Global
Protocols: +LLMNR +mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: stub
Link 2 (eth0)
Current Scopes: DNS
Current DNS Server: 10.0.0.53
DNS Servers: 10.0.0.53 10.0.0.54
DNS Domain: corp.example.com
Link 5 (wg0)
DNS Servers: 172.16.8.1
DNS Domain: ~vpn.example.com
$ resolvectl query app.vpn.example.com
app.vpn.example.com: 172.16.8.40 -- link: wg0
$ resolvectl statistics
$ resolvectl flush-caches
The resolvectl manual documents status (global and per-link DNS settings), query, statistics, flush-caches and per-link dns/domain settings, where a ~ prefix makes a domain route-only.
How systemd-resolved routes a query
1. A link whose domain (search or ~route-only) best matches the name gets the query.
2. With no match, links marked as default route get it.
3. /etc/resolv.conf → nameserver 127.0.0.53 sends applications to the stub resolver.
Typical problems
| Symptom | Cause | Fix |
|---|---|---|
| VPN names fail | VPN link has no ~domain, queries go to the LAN server | resolvectl domain wg0 '~vpn.example.com' (or in the VPN config) |
| Internal names leak to public DNS | Default-route link with public resolvers | Route-only domains; DNSDefaultRoute=no on that link |
/etc/resolv.conf overwritten by another tool | Not a symlink to /run/systemd/resolve/stub-resolv.conf | Decide which component owns it |
| Containers cannot resolve | They cannot reach 127.0.0.53 | Use upstream servers file /run/systemd/resolve/resolv.conf for them |
| Short names fail | No search domain | Domains=corp.example.com in network config |
Test layers separately
| Tool | Path |
|---|---|
getent hosts name | NSS — what applications see (files, resolved, …) |
resolvectl query name | systemd-resolved with its routing |
dig @10.0.0.53 name | One server directly, bypassing local logic |
Comparing the three shows whether the problem is local configuration, routing between links, or the DNS server itself.
*The resolvectl link and DNS server entries illustrate split DNS selection, not an exported resolver configuration.*
How it works at runtime
DNS Troubleshooting is part of DNS → DNS Troubleshooting. DNS Troubleshooting isolates Linux name-resolution failures by separating application resolver behavior, local static/NSS policy, generated resolver configuration, stub/cache state, upstream server reachability, DNS response semantics and the final application endpoint.
Topic-specific state model. DNS Troubleshooting isolates Linux name-resolution failures by separating application resolver behavior, local static/NSS policy, generated resolver configuration, stub/cache state, upstream server reachability, DNS response semantics and the final application endpoint.
Interpretation rule. - NXDOMAIN ≠ timeout; response-code failures and transport failures have different first boundaries.
- SERVFAIL ≠ authoritative name does not exist; recursion, DNSSEC or upstream dependency can fail.
- DNS query succeeds ≠ original application lookup succeeds when it uses different search/family/cache policy.
- Flushing cache or restarting resolved ≠ root cause fixed unless the original failure and persistence condition are verified.
Method
DNS troubleshooting on Linux:
getent hosts app.example.com # application view
dig app.example.com # uses resolv.conf servers
dig @10.0.0.53 app.example.com +norecurse
dig app.example.com +trace
resolvectl query app.example.com
systemd-resolve --statistics 2>/dev/null || resolvectl statistics
tcpdump -ni any port 53
| Symptom | Cause |
|---|---|
getent works, dig fails | Name only in /etc/hosts |
| Short names fail | Missing search domain |
| Slow lookups (5 s delays) | First nameserver unreachable, IPv6 AAAA timeouts (single-request option) |
| VPN names fail | Missing routing domain in resolved |
| SERVFAIL | Upstream/DNSSEC validation failure |
Limits and how it fails
Primary failure point. DNS troubleshooting is resolved only when the first failed resolver boundary is corrected and the original application lookup succeeds with the intended answer under the same network/view conditions; diagnostic-tool success alone is insufficient.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Distribution/platform context. DNS Troubleshooting owns resolver fault isolation. Continue to Linux Networking/Firewall when transport fails, to DNS infrastructure when server/authority fails, or to the application when resolution is correct but service use fails.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in DNS → DNS Troubleshooting. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.freedesktop.org/software/systemd/man/latest/systemd-resolved.service.html · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
DNS Troubleshooting operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for DNS Troubleshooting.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | DNS Troubleshooting isolates Linux name-resolution failures by separating application resolver behavior, local static/NSS policy, generated resolver configuration, stub/cache state, upstream server reachability, DNS response semantics and the final application endpoint. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin exact host/namespace + original name or endpoint → capture link/address/route/resolver state → reproduce original failure → localize first failed resolver/network boundary → collect bounded packet/socket or DNS evidence → change one demonstrated cause → read back effective state → repeat original application transaction and an adjacent regression check. | Use the shortest evidence path first; a fast check is a boundary test, not blanket proof. |
| Verification chain | original application failure → resolver API/NSS → hosts/resolv.conf ownership → local stub/cache → selected upstream reachability → DNS RCODE/answer/TTL/view → address selection → original application retry | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | DNS troubleshooting closes only when the first failed resolver boundary is corrected and the original application lookup succeeds with the intended answer under the same network/view conditions; diagnostic-tool success alone is insufficient. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux DNS/network evidence can establish this proof path: original application failure → resolver API/NSS → hosts/resolv.conf ownership → local stub/cache → selected upstream reachability → DNS RCODE/answer/TTL/view → address selection → original application retry | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It does not independently prove behavior outside the captured host/network namespace, resolver path or DNS view, interface/source, destination/protocol/port, capture point, time or workload scope. DNS troubleshooting closes only when the first failed resolver boundary is corrected and the original application lookup succeeds with the intended answer under the same network/view conditions; diagnostic-tool success alone is insufficient. | Do not promote a local success signal into end-to-end or adjacent-dependency proof. |
| Next troubleshooting check | Continue from the first unproven DNS/network boundary: preserve the original source and failure conditions, capture the adjacent resolver/socket/packet state, change only the demonstrated cause, then repeat the original application lookup or transaction and adjacent regression checks. | Continue to the next unresolved boundary while preserving the original test condition. |
DNS Troubleshooting · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | DNS Troubleshooting |
|---|---|
| Topic path | DNS → DNS Troubleshooting |
| Runtime state | DNS Troubleshooting isolates Linux name-resolution failures by separating application resolver behavior, local static/NSS policy, generated resolver configuration, stub/cache state, upstream server reachability, DNS response semantics and the final application endpoint. |
| Fast checks | - Record exact query name/type, original application error, timestamp, network namespace/interface and whether short-name search expansion is involved. - Compare getent/application lookup, resolvectl state/query and direct dig to the selected upstream while preserving A/AAAA and DNS view. - Classify first failure as local policy/config, stub/cache, reachability, DNS protocol/response, wrong data/view or post-DNS endpoint failure. - Make one minimal change, repeat the original application lookup, verify intended endpoint and test persistence across link/VPN/DHCP renewal when relevant. |
| Verification chain | original application failure → resolver API/NSS → hosts/resolv.conf ownership → local stub/cache → selected upstream reachability → DNS RCODE/answer/TTL/view → address selection → original application retry Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary. |
| Failure boundary | DNS troubleshooting closes only when the first failed resolver boundary is corrected and the original application lookup succeeds with the intended answer under the same network/view conditions; diagnostic-tool success alone is insufficient. Boundary chain: process/socket namespace → source/rule/FIB → neighbor → netfilter/eBPF/qdisc → virtual/physical device → peer → return → application. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |