Systemd-resolved

From LinuxReviews
Jump to navigationJump to search

systemd-resolved is a all-in-one name resolution manager which is somewhat tied to NetworkManager. It can act as a service for applications and resolve regular DNS, multi-cast DNS.

Configuration[edit | edit source]

systemd-resolved is configured in the file /etc/systemd/resolved.conf where the basic options are DNS=, FallbackDNS=, MulticastDNS= and DNSStubListener=

A basic example would be:

File: /etc/systemd/resolved.conf
[Resolve]
# Resolve using Cloudflare DNS
DNS=1.1.1.1 1.0.0.1
# Fallback to Google if Cloudflare is unavailable
FallbackDNS=8.8.8.8
# Listen for multicast DNS
MulticastDNS=yes
# respond to DNS requests on 127.0.0.53
DNSStubListener=yes

The systemd-resolved manual has more details if the above isn't obvious enough for you.

Do note that there isn't much it can do in terms of multicast beyond resolving .local hostnames. You need to disable systemd-resolved's multicast DNS feature and use avahi-daemon for advanced uses like announcing services.

Turning it off - permanently[edit | edit source]

If you have setup your own DNS server using Unbound or something else and you do NOT want to use systemd-resolved then this is desired and required:

File: /etc/systemd/resolved.conf
[Resolve]
[Resolve]
DNS=127.0.0.1
FallbackDNS=1.0.0.1
MulticastDNS=no
DNSStubListener=no

You need to make sure systemd-resolved is not set to listen on 127.0.0.1 with DNSStubListener=no or mDNS with MulticastDNS=no even if you have disabled it with:

systemctl disable systemd-resolved.service

It will start when certain applications make API requests to systemd when it is disabled and even when you have masked it with systemctl mask systemd-resolved.service

Disabling it in the configuration file is the only thing short of removing the binary which works if you want it disabled.