Index · Directives systemd 229

Name

systemd-resolved.service, systemd-resolved — Network Name Resolution manager

Synopsis

systemd-resolved.service

/usr/lib/systemd/systemd-resolved

Description

systemd-resolved is a system service that provides network name resolution to local applications. It implements a caching and validating DNS/DNSSEC stub resolver, as well as an LLMNR resolver and responder. In addition it maintains the /run/systemd/resolve/resolv.conf file for compatibility with traditional Linux programs. This file may be symlinked from /etc/resolv.conf.

The glibc NSS module nss-resolve(8) is required to permit glibc's NSS resolver functions to resolve host names via systemd-resolved.

The DNS servers contacted are determined from the global settings in /etc/systemd/resolved.conf, the per-link static settings in /etc/systemd/network/*.network files, and the per-link dynamic settings received over DHCP. See resolved.conf(5) and systemd.network(5) for details. To improve compatibility, /etc/resolv.conf is read in order to discover configured system DNS servers, but only if it is not a symlink to /run/systemd/resolve/resolv.conf (see above).

systemd-resolved synthesizes DNS RRs for the following cases:

  • The local, configured hostname is resolved to all locally configured IP addresses ordered by their scope, or — if none are configured — the IPv4 address 127.0.0.2 (which is on the local loopback) and the IPv6 address ::1 (which is the local host).

  • The hostname "localhost" (as well as any hostname ending in ".localhost", ".localdomain" or equal to "localdomain") is resolved to the IP addresses 127.0.0.1 and ::1.

  • The hostname "gateway" is resolved to all current default routing gateway addresses, ordered by their metric. This assigns a stable hostname to the current gateway, useful for referencing it independently of the current network configuration state.

  • The mappings defined in /etc/hosts are resolved to their configured addresses and back.

Lookup requests are routed to the available DNS servers and LLMNR interfaces according to the following rules:

  • Lookups for the special hostname "localhost" are never routed to the network. (A few other, special domains are handled the same way.)

  • Single-label names are routed to all local interfaces capable of IP multicasting, using the LLMNR protocol. Lookups for IPv4 addresses are only sent via LLMNR on IPv4, and lookups for IPv6 addresses are only sent via LLMNR on IPv6. Lookups for the locally configured host name and the "gateway" host name are never routed to LLMNR.

  • Multi-label names are routed to all local interfaces that have a DNS sever configured, plus the globally configured DNS server if there is one. Address lookups from the link-local address range are never routed to DNS.

If lookups are routed to multiple interfaces, the first successful response is returned (thus effectively merging the lookup zones on all matching interfaces). If the lookup failed on all interfaces, the last failing response is returned.

Routing of lookups may be influenced by configuring per-interface domain names. See systemd.network(5) for details. Lookups for a hostname ending in one of the per-interface domains are exclusively routed to the matching interfaces.

Note that /run/systemd/resolve/resolv.conf should not be used directly by applications, but only through a symlink from /etc/resolv.conf.

See the resolved D-Bus API Documentation for information about the APIs systemd-resolved provides.

See Also

systemd(1), resolved.conf(5), dnssec-trust-anchors.d(5), nss-resolve(8), systemd-resolve(1), resolv.conf(5), hosts(5), systemd.network(5), systemd-networkd.service(8)