AlmaLinux 10: three listeners on port 53 and who answers what
Test scope
Section titled “Test scope”An AlmaLinux 10.2 Server VM with systemd-resolved-257-23.el10_2.1.alma.1 and dnsmasq-2.90.
This host is both the LAN resolver (dnsmasq on 192.168.2.241:53) and a system with systemd-resolved as its local entry point. Screenshot: public/evidence/resolved/alma-coexist.png.
Three listeners, no conflict
Section titled “Three listeners, no conflict”$ ss -lunp | grep ':53 'UNCONN 0 0 127.0.0.54:53 ... systemd-resolveUNCONN 0 0 127.0.0.53%lo:53 ... systemd-resolveUNCONN 0 0 192.168.2.241:53 ... dnsmasq127.0.0.53: the resolved stub local applications use;127.0.0.54: resolved’s proxy/DoT listener (enabled by default);192.168.2.241:53: dnsmasq serving the LAN.
They bind different addresses, so they coexist. The real clash is two daemons both binding 0.0.0.0:53 — which normally happens when bind-interfaces is missing.
Pointing one domain back at the local dnsmasq
Section titled “Pointing one domain back at the local dnsmasq”$ resolvectl dns ens18 192.168.2.241$ resolvectl domain ens18 '~lab.test'$ resolvectl query web.lab.testweb.lab.test: 192.168.2.241 -- link: ens18Note the upstream is 192.168.2.241, not 127.0.0.1: dnsmasq is bound to that address only, so 127.0.0.1 yields Connection refused — the first mistake we made here.
Reading resolvectl status
Section titled “Reading resolvectl status”$ resolvectl status ens18Link 2 (ens18) Current Scopes: DNS Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupportedCurrent DNS Server: 192.168.2.241 DNS Servers: 192.168.2.241 DNS Domain: ~lab.test| Field | Meaning |
|---|---|
Current Scopes: DNS | the link takes part in DNS routing |
Current DNS Server | the server actually used |
DNS Domain: ~lab.test | with ~ it is a routing domain |
DNSSEC=no/unsupported | validation currently off |
What /etc/resolv.conf really is
Section titled “What /etc/resolv.conf really is”With resolved installed, /etc/resolv.conf is usually a symlink to /run/systemd/resolve/stub-resolv.conf. Consequences:
- editing it does not change resolved’s behaviour and is overwritten;
- change the link configuration instead (
resolvectlornmcli); - to bypass resolved entirely, disable it or have applications talk to a specific server.
Common traps
Section titled “Common traps”- Using
127.0.0.1as upstream: the stub owns that port and dnsmasq is elsewhere; - Treating the stub as “the real DNS”: it is a local proxy; answers still come from upstream;
- Two sources of truth: when both
nmcliandresolvectlset DNS, the connection’s configuration wins on activation; - Concluding it is broken because
dig @127.0.0.53fails: the stub is not a general-purpose server; useresolvectl query.
Practice: inspect the link configuration
Section titled “Practice: inspect the link configuration”resolvectl status ens18 | sed -n '1,10p'ss -lunp | grep ':53 'resolvectl query web.lab.testsudo resolvectl flush-cachesresolvectl statistics | head -6Checks:
- Which listener belongs to which process;
- Whether
DNS Domaincarries the~; - Whether answers are tagged
-- link: ens18; - That
flush-cachesresets the cache counters.
常见问题
Must I choose between resolved and dnsmasq?
No. resolved can be the local entry point while dnsmasq serves the LAN, as long as they bind different addresses.
How do I enable DNSSEC?
Set DNSSEC=yes (or allow-downgrade) in resolved.conf, then check the validation state in resolvectl query output.
Why is /etc/resolv.conf a symlink?
resolved took it over; that is expected and hand edits are overwritten at the next start.
Next steps
Section titled “Next steps”- resolved basics: /en/systemd-resolved/
- dnsmasq: /en/dnsmasq-lab/
- Network basics: /en/network-basics/