How DNS Actually Works on Ubuntu 26.04: A Deep Dive into Two Layers
A developer conducted a detailed investigation into DNS resolution on a fresh Ubuntu 26.04 server, tracing a name lookup from application to answering server. DNS on Ubuntu operates in two distinct layers: the C library's name lookup, which checks /etc/hosts first via /etc/nsswitch.conf, and the systemd-resolved stub resolver listening on 127.0.0.53. Systemd-resolved acts as a local caching resolver that forwards queries to upstream DNS servers learned per network interface from DHCP or Netplan configuration. Tools like dig and nslookup bypass the first layer entirely, which explains why they can return different results than ping or curl. Key practical takeaways include using resolvectl to inspect upstream servers and query results, editing Netplan rather than resolv.conf for upstream changes, and understanding split DNS for per-domain routing used by tools like Tailscale's MagicDNS.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in