Skip to main content

systemd-resolved

systemd-resolved is a systemd service that provides network name resolution to local applications via a D-Bus interface, the resolve NSS service, and a local DNS stub listener on 127.0.0.53.

Traditionally, /etc/resolv.conf has been used to handle name resolution. Below is an example of this file on a system that uses systemd-resolved:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "systemd-resolve --status" to see details about the actual nameservers.

nameserver 127.0.0.53
search localdomain.loc

The systemd specific configuration file is /etc/systemd/resolved.conf. An example is shown below that uses Quad9 for primary DNS resolution with fallback to Google's Public DNS. The Ubuntu man page for resolve.conf is located here.

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See resolved.conf(5) for details

[Resolve]
# Use Quad9 for normal resolution
DNS=9.9.9.9 149.112.112.112
# Use Google Public DNS in case of a failure of Quad9
FallbackDNS=8.8.8.8 8.8.4.4
Domains=bluecrow.net
LLMNR=no
MulticastDNS=no
#DNSSEC=no
#Cache=yes
#DNSStubListener=yes