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

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
- Open
/etc/systemd/resolved.confin your favorite text editor. - Find
DNSStubListenersetting and set it tono.
[Resolve]
...
#Cache=no-negative
DNSStubListener=no
...
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
