Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

DNS Troubleshooting

Direct answer

DNS troubleshooting on Linux separates where resolution fails: the application, nsswitch and /etc/hosts, the local stub, the upstream server, or the authoritative data.

When to use this

Use it when names fail, resolve slowly or resolve to the wrong address.

First 30 seconds

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.

Operational verification

application → nsswitch → hosts file → stub cache → upstream → authoritative answer

Evidence · next step

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
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Key commanddig @10.0.0.53 example.com
Scope / prerequisiteUse it when names fail, resolve slowly or resolve to the wrong address.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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 references

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.

observation · 1
Key points

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.

Key checks
  • dig +trace <name> — follow delegation from the root
  • resolvectl status — DNS servers per link (systemd-resolved)
  • cat /etc/resolv.conf — configured nameservers
  • getent 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

SymptomCauseFix
VPN names failVPN link has no ~domain, queries go to the LAN serverresolvectl domain wg0 '~vpn.example.com' (or in the VPN config)
Internal names leak to public DNSDefault-route link with public resolversRoute-only domains; DNSDefaultRoute=no on that link
/etc/resolv.conf overwritten by another toolNot a symlink to /run/systemd/resolve/stub-resolv.confDecide which component owns it
Containers cannot resolveThey cannot reach 127.0.0.53Use upstream servers file /run/systemd/resolve/resolv.conf for them
Short names failNo search domainDomains=corp.example.com in network config

Test layers separately

ToolPath
getent hosts nameNSS — what applications see (files, resolved, …)
resolvectl query namesystemd-resolved with its routing
dig @10.0.0.53 nameOne 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.*

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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
SymptomCause
getent works, dig failsName only in /etc/hosts
Short names failMissing search domain
Slow lookups (5 s delays)First nameserver unreachable, IPv6 AAAA timeouts (single-request option)
VPN names failMissing routing domain in resolved
SERVFAILUpstream/DNSSEC validation failure
Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

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
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

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%
Technical changelog & impact

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.

Terminology layer

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.

Aliases that resolve here
dns failure linuxlinux dns troubleshootingtemporary failure in name resolutionname or service not known
Embedded reference data

Quick lookup tables

DNS Troubleshooting operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for DNS Troubleshooting.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateDNS 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 verificationPin 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 chainoriginal application failure → resolver API/NSS → hosts/resolv.conf ownership → local stub/cache → selected upstream reachability → DNS RCODE/answer/TTL/view → address selection → original application retryTrace requested/configured state through effective state to the observed workload result.
Failure boundaryDNS 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 evidenceCorrelated 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 retryUse this observation only for the specific claim it actually supports.
Evidence limitIt 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 checkContinue 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 boundaryDNS Troubleshooting
Topic pathDNS → DNS Troubleshooting
Runtime stateDNS 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 chainoriginal 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 boundaryDNS 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 ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?