Why systemd‑resolved is giving you 127.0.0.1 for every host
Ubuntu 24.04 ships with systemd‑resolved as the DNS resolver.
If every hostname you look up ends up at 127.0.0.1, the most common culprit is the search‑domain order that resolved builds.
It pulls the list from three places:
/etc/resolv.conf(or theDNS=/Domains=directives in/etc/systemd/resolved.conf)- DHCP‑provided domains
- The machine’s own hostname (
$HOSTNAME)
When localhost or the local hostname lands at the top, the resolver will try it before forwarding the query to the real DNS servers, and you’ll get a loopback address for any name that isn’t fully qualified.