Programster's Blog

Tutorials focusing on Linux, programming, and open-source

Configure Systemd Nameservers

You almost always want to configure your nameservers somewhere else, such as in a netplan configuration etc. However, if you wish to configure your nameservers through systemd where it will manage your /etc/resolv.conf file, then run:

sudo editor /etc/systemd/resolved.conf

Then set something like below within the [Resolve] section of the config file:

[Resolve]
DNS=192.168.0.222 192.168.0.221
FallbackDNS=8.8.8.8

In this example, I have two local DNS servers at 192.168.0.222 and 192.168.0.221 that I wish to use primarily.

References

Last updated: 1st June 2024
First published: 20th May 2023