Configuring DNS Resolvers in systemd-resolved
Overview
On systems using systemd-resolved
, such as Arch Linux and many of its derivatives like #CachyOS, managing DNS resolves is handled through a simple
Checking current configuration
View the current config with systemd-analyze cat-config systemd/resolved.conf
This will also indicate the location of the configuration on the first line of output.
Configure DNS Resolvers
In my setup, I want to make sure my #homelab DNS servers are preferred, so I make sure the local resolvers are known to my systems.
- Open up
/etc/systemd/resolved.conf
with a text editor - Below the
[Resolve]
section, add your DNS servers- uncomment
DNS=
and add a server(s) - optional uncomment
FallbackDNS=
and add some public name servers
- uncomment
- Make the changes active by restarting the service with
sudo systemctl restart systemd-resolved