DNS Troubleshooting
Cheat sheet · https://pcornel.dk/topic.php?topic=2792
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.
Remember
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.
First checks
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
Commands
resolvectlresolvectl domain wg0 '~vpn.example.com'getent hosts nameresolvectl query namedig @10.0.0.53 namegetentdig
Verify in this order
application → nsswitch → hosts file → stub cache → upstream → authoritative answer
Where it usually breaks
First mismatch in link/interface → address/namespace → route/neighbor → firewall/policy → socket/daemon → DNS/TLS/SSH/application peer path; preserve identity/native diagnostic/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2792