Frequently Asked Question
How does DNS actually work?
The Domain Name System turns a human-readable name like google.com into the
numeric address a packet needs. When you type a name, your machine first asks a
recursive resolver (typically your ISP's, or 8.8.8.8, or 1.1.1.1). If the
answer isn't cached, the resolver walks the DNS tree from the top: it asks one
of 13 root servers which name servers handle .com, asks those for google.com's
name servers, and asks those for the actual A or AAAA record. The answer comes
back, gets cached with a TTL, and you connect.
On Linux the resolver configuration lives in /etc/resolv.conf, which lists
nameserver entries to use. On most modern desktops this file is generated
automatically by systemd-resolved (which also caches answers and supports
DNS over TLS) or by NetworkManager. /etc/hosts is consulted first and is the
way to override DNS locally, that's how localhost resolves to 127.0.0.1
without any server involvement.