Pcornel
Linux · DNS

systemd-resolved

Cheat sheet · https://pcornel.dk/topic.php?topic=2790

Back to the Topic

Answer

systemd-resolved is a local DNS stub resolver (127.0.0.53) that caches answers, supports per-interface DNS servers (useful with VPNs), DNSSEC and DNS-over-TLS.

Remember

resolvectl status shows the servers per link. Flush the cache with resolvectl flush-caches. Split DNS for VPNs uses routing domains (~corp.example).

First checks

  • resolvectl query <name> — resolve and show which link/server
  • resolvectl status — DNS servers per link (systemd-resolved)
  • cat /etc/resolv.conf — configured nameservers
  • getent hosts <name> — resolution through the system path (nsswitch)
  • dig <name> @<server> — query a specific server

Commands

resolvectl flush-caches
resolvectl status
resolvectl query name
resolvectl dns wg0 10.99.0.53
resolvectl domain wg0 '~corp.example.net'
resolvectl statistics

Verify in this order

application → stub 127.0.0.53 → resolved picks the link by domain → upstream server → cached answer

Where it usually breaks

First mismatch in link/interface → address/namespace → route/neighbor → firewall/policy → socket/daemon → DNS/TLS/SSH/application peer path; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2790

Confirmation

Confirm action

Continue?