DNS (Domain Name System)
Cheat sheet · https://pcornel.dk/topic.php?topic=2788
Answer
DNS on Linux: applications resolve names through glibc, which follows /etc/nsswitch.conf (usually files, then dns); DNS queries go to the servers in /etc/resolv.conf — often the systemd-resolved stub 127.0.0.53, which forwards to the real servers.
Remember
dig and nslookup bypass nsswitch and /etc/hosts — use getent hosts to test what applications see. With systemd-resolved, check real upstream servers with resolvectl status, not resolv.conf.
First checks
resolvectl 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
resolvectl- Inspect or change systemd-resolved DNS servers, search domains and per-link resolver state.
hostname- Display or change the current system hostname depending on invocation and privilege.
dig- Issue DNS queries and display response sections, flags, timing and selected resolver behavior.
nslookup- Perform interactive or one-shot DNS lookups against the configured or selected resolver.
host- Perform concise DNS name and address lookups and common record-type queries.
getent hosts namepingcurlresolvectl query namegetent
Verify in this order
application → glibc → nsswitch (files, dns) → resolv.conf / stub → upstream DNS → 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=2788