Skip to main content

↘ How to disable systemd-resolved through resolved.conf settings

· One min read
Yevgeniy Goncharov
Maintainer of OpenBLD.net

OpenBLD.net - How to disable systemd-resolved

Intro

In short, the systemd-resolved service is a system service that provides network name resolution to local applications. It implements a caching DNS stub resolver and an LLMNR resolver and responder.

See the official documentation for more information.

In some cases, you may need to disable this service. For example, if you are using a custom DNS server or if you are using a VPN service that provides its own DNS servers. You can disable Systemd-resolved using your own settings in the resolved.conf file.

How to disable systemd-resolved

  1. Open /etc/systemd/resolved.conf in your favorite text editor.
  2. Find DNSStubListener setting and set it to no.
[Resolve]
...
#Cache=no-negative
DNSStubListener=no
...
tip

You can create additional config in the /etc/systemd/resolved.conf.d/ directory. For example, you can create a file /etc/systemd/resolved.conf.d/00-disable-stub.conf with the following content:

[Resolve]
DNSStubListener=no

Then you need to set /etc/resolv.conf as symlink to /run/systemd/resolve/resolv.conf:

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

After that, restart the systemd-resolved service:

systemctl restart systemd-resolved