search

Configure `resolvectl`

Wed, May 21, 2025 02:00 CEST

Tags: Arch, DNS, Forwarding, Network, Resolvectl, Sytemd-Resolved

Configure your favorite DNS servers with systemd-resolved.

# file: /etc/systemd/resolved.conf
...
[Resolve]
# SEE: https://git.fdn.fr/fdn-public/wiki/-/blob/master/support/faq/config_dns.md
DNS=80.67.169.12#ns0.fdn.fr 2001:910:800::12#ns0.fdn.fr
FallbackDNS=80.67.169.40#ns1.fdn.fr 2001:910:800::40#ns1.fdn.fr
DNSOverTLS=yes

Enable and start it

systemctl enable --now systemd-resolved

Test it works

resolvectl query go.dnscheck.tools

Disable dhcpcd/resolvconf integration.

# file: /etc/dhcpcd.conf
...
nohook resolv.conf

Enable systemd-resolved’s stub resolver

cp /etc/resolv.conf{,.bak}
cp /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf

Test it works

dig go.dnscheck.tools

Should reply with

...
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
...

Once you have tested this works and restarted your machine at least once, checking resolv.conf does not get overwritten by dhcpcd, you can link it instead.

ln -sf ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf