/etc/hosts
Cheat sheet · https://pcornel.dk/topic.php?topic=2791
Answer
/etc/hosts maps names to IP addresses locally, consulted before DNS when nsswitch.conf says hosts: files dns.
Remember
An old entry in /etc/hosts silently overrides DNS — check it first when one host resolves differently. Keep it minimal on servers (localhost and the host's own name).
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
dig
Verify in this order
lookup → nsswitch "files" → /etc/hosts match returns first → otherwise DNS
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=2791