Understanding DNS on Linux: BIND, dnsmasq, and systemd-resolved

DNS resolution on modern Linux is more layered than most people realize — there isn’t one single “DNS service,” but rather a stack of tools that can each play different roles depending on your distro and setup.

systemd-resolved: The Modern Default

On most current distros, systemd-resolved acts as a local caching stub resolver — applications query it on 127.0.0.53, and it forwards to your configured upstream DNS servers, caching responses to speed up repeated lookups:

resolvectl status
resolvectl query example.com

# Flush the resolver cache after DNS changes
sudo resolvectl flush-caches

dnsmasq: Lightweight DNS + DHCP

dnsmasq is the go-to choice for small networks and home labs — a single lightweight binary providing both DNS caching/forwarding and DHCP, common on routers and small VM/container hosts:

# Serve local hostnames for the home network
address=/nas.home/192.168.1.50
address=/printer.home/192.168.1.60

# Upstream DNS servers
server=1.1.1.1
server=1.0.0.1

# Cache size
cache-size=1000

BIND: Full Authoritative and Recursive Server

BIND (Berkeley Internet Name Domain) is the heavyweight option — a full authoritative and recursive DNS server capable of hosting actual zones for a domain, still the backbone of a huge share of the internet’s DNS infrastructure decades after its creation:

# Verify a zone file for syntax errors before reloading
named-checkzone example.com /etc/bind/db.example.com

sudo systemctl reload bind9

Which One Do You Need?

For a workstation, systemd-resolved just works out of the box. For a home lab wanting local hostname resolution and DHCP in one tool, dnsmasq is the pragmatic choice. Only reach for BIND if you’re actually hosting authoritative DNS zones for a real domain.