Guide to DNS on Ubuntu 26.04
For years my understanding of DNS on a Linux box was one file. /etc/resolv.conf has a nameserver line, that is where lookups go, done. Then at some point I opened it on an Ubuntu server and it said nameserver 127.0.0.53 , which is a DNS server I never installed, running on an address I never configured, and I closed the file and got on with my day. I have since written a Netplan post and three…
When you run a name lookup on an Ubuntu 26.04 server, there are two layers involved: the C library's name lookup and the resolver. The first layer is the C library's lookup, which consults /etc/hosts first and then uses the resolver. This layer is responsible for turning a name into an address, and it never involves a network round trip.
The second layer is the resolver, which in Ubuntu 26.04 is systemd-resolved. This resolver is listening on 127.0.0.53 and handles caching and forwarding your question to the right upstream server based on the network interface. Programs like ping, curl, ssh, and Python scripts all go through the first layer, while dig, host, and nslookup can skip the first layer entirely and talk directly to the resolver.
To check the current configuration, you can run resolvectl status, which shows the upstream servers and the protocols used (in this case, LLMNR and mDNS).
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.