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:


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


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