1SYSTEMD-RESOLVED.SERVICE(8)systemd-resolved.serviceSYSTEMD-RESOLVED.SERVICE(8)
2
3
4

NAME

6       systemd-resolved.service, systemd-resolved - Network Name Resolution
7       manager
8

SYNOPSIS

10       systemd-resolved.service
11
12       /usr/lib/systemd/systemd-resolved
13

DESCRIPTION

15       systemd-resolved is a system service that provides network name
16       resolution to local applications. It implements a caching and
17       validating DNS/DNSSEC stub resolver, as well as an LLMNR and
18       MulticastDNS resolver and responder. Local applications may submit
19       network name resolution requests via three interfaces:
20
21       ·   The native, fully-featured API systemd-resolved exposes on the bus,
22           see org.freedesktop.resolve1(5) and org.freedesktop.LogControl1(5)
23           for details. Usage of this API is generally recommended to clients
24           as it is asynchronous and fully featured (for example, properly
25           returns DNSSEC validation status and interface scope for addresses
26           as necessary for supporting link-local networking).
27
28       ·   The glibc getaddrinfo(3) API as defined by RFC3493[1] and its
29           related resolver functions, including gethostbyname(3). This API is
30           widely supported, including beyond the Linux platform. In its
31           current form it does not expose DNSSEC validation status
32           information however, and is synchronous only. This API is backed by
33           the glibc Name Service Switch (nss(5)). Usage of the glibc NSS
34           module nss-resolve(8) is required in order to allow glibc's NSS
35           resolver functions to resolve hostnames via systemd-resolved.
36
37       ·   Additionally, systemd-resolved provides a local DNS stub listener
38           on IP address 127.0.0.53 on the local loopback interface. Programs
39           issuing DNS requests directly, bypassing any local API may be
40           directed to this stub, in order to connect them to
41           systemd-resolved. Note however that it is strongly recommended that
42           local programs use the glibc NSS or bus APIs instead (as described
43           above), as various network resolution concepts (such as link-local
44           addressing, or LLMNR Unicode domains) cannot be mapped to the
45           unicast DNS protocol.
46
47       The DNS servers contacted are determined from the global settings in
48       /etc/systemd/resolved.conf, the per-link static settings in
49       /etc/systemd/network/*.network files (in case systemd-
50       networkd.service(8) is used), the per-link dynamic settings received
51       over DHCP, information provided via resolvectl(1), and any DNS server
52       information made available by other system services. See
53       resolved.conf(5) and systemd.network(5) for details about systemd's own
54       configuration files for DNS servers. To improve compatibility,
55       /etc/resolv.conf is read in order to discover configured system DNS
56       servers, but only if it is not a symlink to
57       /run/systemd/resolve/stub-resolv.conf, /usr/lib/systemd/resolv.conf or
58       /run/systemd/resolve/resolv.conf (see below).
59

SYNTHETIC RECORDS

61       systemd-resolved synthetizes DNS resource records (RRs) for the
62       following cases:
63
64       ·   The local, configured hostname is resolved to all locally
65           configured IP addresses ordered by their scope, or — if none are
66           configured — the IPv4 address 127.0.0.2 (which is on the local
67           loopback interface) and the IPv6 address ::1 (which is the local
68           host).
69
70       ·   The hostnames "localhost" and "localhost.localdomain" as well as
71           any hostname ending in ".localhost" or ".localhost.localdomain" are
72           resolved to the IP addresses 127.0.0.1 and ::1.
73
74       ·   The hostname "_gateway" is resolved to all current default routing
75           gateway addresses, ordered by their metric. This assigns a stable
76           hostname to the current gateway, useful for referencing it
77           independently of the current network configuration state.
78
79       ·   The mappings defined in /etc/hosts are resolved to their configured
80           addresses and back, but they will not affect lookups for
81           non-address types (like MX). Support for /etc/hosts may be disabled
82           with ReadEtcHosts=no, see resolved.conf(5).
83

PROTOCOLS AND ROUTING

85       Lookup requests are routed to the available DNS servers, LLMNR, and
86       MulticastDNS interfaces according to the following rules:
87
88       ·   Names for which synthetic records are generated (the local
89           hostname, "localhost" and "localdomain", local gateway, as listed
90           in the previous section) and addresses configured in /etc/hosts are
91           never routed to the network and a reply is sent immediately.
92
93       ·   Single-label names are resolved using LLMNR on all local interfaces
94           where LLMNR is enabled. Lookups for IPv4 addresses are only sent
95           via LLMNR on IPv4, and lookups for IPv6 addresses are only sent via
96           LLMNR on IPv6. Note that lookups for single-label synthetized names
97           are not routed to LLMNR, MulticastDNS or unicast DNS.
98
99       ·   Queries for the address records (A and AAAA) of single-label
100           non-synthetized names are resolved via unicast DNS using search
101           domains. For any interface which defines search domains, such
102           look-ups are routed to that interface, suffixed with each of the
103           search domains defined on that interface in turn. When global
104           search domains are defined, such look-ups are routed to all
105           interfaces, suffixed by each of the global search domains in turn.
106           Additionally, lookup of single-label names via unicast DNS may be
107           enabled with the ResolveUnicastSingleLabel=yes setting. The details
108           of which servers are queried and how the final reply is chosen are
109           described below. Note that this means that address queries for
110           single-label names are never sent out to remote DNS servers by
111           default, and resoulution is only possible if search domains are
112           defined.
113
114       ·   Multi-label names with the domain suffix ".local" are resolved
115           using MulticastDNS on all local interfaces where MulticastDNS is
116           enabled. As with LLMNR, IPv4 address lookups are sent via IPv4 and
117           IPv6 address lookups are sent via IPv6.
118
119       ·   Queries for multi-label names are routed via unicast DNS on local
120           interfaces that have a DNS server configured, plus the globally
121           configured DNS servers if there are any. Which interfaces are used
122           is determined by the routing logic based on search and route-only
123           domains, described below. Note that by default, lookups for domains
124           with the ".local" suffix are not routed to DNS servers, unless the
125           domain is specified explicitly as routing or search domain for the
126           DNS server and interface. This means that on networks where the
127           ".local" domain is defined in a site-specific DNS server, explicit
128           search or routing domains need to be configured to make lookups
129           work within this DNS domain. Note that these days, it's generally
130           recommended to avoid defining ".local" in a DNS server, as
131           RFC6762[2] reserves this domain for exclusive MulticastDNS use.
132
133       ·   Address lookups (reverse lookups) are routed similarly to
134           multi-label names, with the exception that addresses from the
135           link-local address range are never routed to unicast DNS and are
136           only resolved using LLMNR and MulticastDNS (when enabled).
137
138       If lookups are routed to multiple interfaces, the first successful
139       response is returned (thus effectively merging the lookup zones on all
140       matching interfaces). If the lookup failed on all interfaces, the last
141       failing response is returned.
142
143       Routing of lookups is determined by the per-interface routing domains
144       (search and route-only) and global search domains. See
145       systemd.network(5) and resolvectl(1) for a description how those
146       settings are set dynamically and the discussion of Domains= in
147       resolved.conf(5) for a description of globally configured DNS settings.
148
149       The following query routing logic applies for unicast DNS traffic:
150
151       ·   If a name to look up matches (that is: is equal to or has as
152           suffix) any of the configured routing domains (search or
153           route-only) of any link, or the globally configured DNS settings,
154           "best matching" routing domain is determined: the matching one with
155           the most labels. The query is then sent to all DNS servers of any
156           links or the globally configured DNS servers associated with this
157           "best matching" routing domain. (Note that more than one link might
158           have this same "best matching" routing domain configured, in which
159           case the query is sent to all of them in parallel).
160
161           In case of single-label names, when search domains are defined, the
162           same logic applies, except that the name is first suffixed by each
163           of the search domains in turn. Note that this search logic doesn't
164           apply to any names with at least one dot. Also see the discussion
165           about compatiblity with the traditional glibc resolver below.
166
167       ·   If a query does not match any configured routing domain (either
168           per-link or global), it is sent to all DNS servers that are
169           configured on links with the DefaultRoute= option set, as well as
170           the globally configured DNS server.
171
172       ·   If there is no link configured as DefaultRoute= and no global DNS
173           server configured, one of the compiled-in fallback DNS servers is
174           used.
175
176       ·   Otherwise the unicast DNS query fails, as no suitable DNS servers
177           can be determined.
178
179       The DefaultRoute= option is a boolean setting configurable with
180       resolvectl or in .network files. If not set, it is implicitly
181       determined based on the configured DNS domains for a link: if there's a
182       route-only domain other than "~.", it defaults to false, otherwise to
183       true.
184
185       Effectively this means: in order to support single-label
186       non-synthetized names, define appropriate search domains. In order to
187       preferably route all DNS queries not explicitly matched by routing
188       domain configuration to a specific link, configure a "~."  route-only
189       domain on it. This will ensure that other links will not be considered
190       for these queries (unless they too carry such a routing domain). In
191       order to route all such DNS queries to a specific link only if no other
192       link is preferred, set the DefaultRoute= option for the link to true
193       and do not configure a "~."  route-only domain on it. Finally, in order
194       to ensure that a specific link never receives any DNS traffic not
195       matching any of its configured routing domains, set the DefaultRoute=
196       option for it to false.
197
198       See the resolved D-Bus API Documentation[3] for information about the
199       APIs systemd-resolved provides.
200

COMPATIBILITY WITH THE TRADITIONAL GLIBC STUB RESOLVER

202       This section provides a short summary of differences in the stub
203       resolver implemented by nss-resolve(8) together with systemd-resolved
204       and the tranditional stub resolver implemented in nss-dns(8).
205
206       ·   Some names are always resolved internally (see Synthetic Records
207           above). Traditionally they would be resolved by nss-files, and only
208           if provided in /etc/hosts.
209
210       ·   Single-label names are not resolved for A and AAAA records using
211           unicast DNS (unless overriden with ResolveUnicastSingleLabel=, see
212           resolved.conf(5)). This is similar to the no-tld-query option being
213           set in resolv.conf(5).
214
215       ·   Search domains are not used for suffixing of multi-label names.
216           (Search domains are nevertheless used for lookup routing, for names
217           that were originally specified as single-label or multi-label.) Any
218           name with at least one dot is always interpreted as a FQDN.
219           nss-dns would resolve names both as relative (using search domains)
220           and absolute FQDN names. Some names would be resolved as relative
221           first, and after that query has failed, as absolute, while other
222           names would be resolved in opposite order. The ndots option in
223           /etc/resolv.conf was used to control how many dots the name needs
224           to have to be resolved as relative first. This stub resolver does
225           not implement this at all: multi-label names are only resolved as
226           FQDNs. (There are currently more than 1500 top-level domain names
227           defined, and new ones are added regularly, often using "attractive"
228           names that are also likely to be used locally. Not looking up
229           multi-label names in this fashion avoids fragility in both
230           directions: a valid global name could be obscured by a local name,
231           and resolution of a relative local name could suddenly break when a
232           new top-level domain is created, or when a new subdomain of a
233           top-level domain in registered. Resolving any given name as either
234           relative or absolute avoids this ambiguity.)
235
236       ·   This resolver has a notion of the special ".local" domain used for
237           MulticastDNS, and will not route queries with that suffix to
238           unicast DNS servers unless explicitly configured, see above. Also,
239           reverse lookups for link-local addresses are not sent to unicast
240           DNS servers.
241
242       ·   This resolver reads and caches /etc/hosts internally. (In other
243           words, nss-resolve replaces nss-files in addition to nss-dns).
244           Entries in /etc/hosts have highest priority.
245
246       ·   This resolver also implements LLMNR and MulticastDNS in addition to
247           the classic unicast DNS protocol, and will resolve single-label
248           names using LLMNR (when enabled) and names ending in ".local" using
249           MulticastDNS (when enabled).
250
251       ·   Environment variables $LOCALDOMAIN and $RES_OPTIONS described in
252           resolv.conf(5) are not supported currently.
253

/ETC/RESOLV.CONF

255       Four modes of handling /etc/resolv.conf (see resolv.conf(5)) are
256       supported:
257
258       ·   systemd-resolved maintains the
259           /run/systemd/resolve/stub-resolv.conf file for compatibility with
260           traditional Linux programs. This file may be symlinked from
261           /etc/resolv.conf. This file lists the 127.0.0.53 DNS stub (see
262           above) as the only DNS server. It also contains a list of search
263           domains that are in use by systemd-resolved. The list of search
264           domains is always kept up-to-date. Note that
265           /run/systemd/resolve/stub-resolv.conf should not be used directly
266           by applications, but only through a symlink from /etc/resolv.conf.
267           This file may be symlinked from /etc/resolv.conf in order to
268           connect all local clients that bypass local DNS APIs to
269           systemd-resolved with correct search domains settings. This mode of
270           operation is recommended.
271
272       ·   A static file /usr/lib/systemd/resolv.conf is provided that lists
273           the 127.0.0.53 DNS stub (see above) as only DNS server. This file
274           may be symlinked from /etc/resolv.conf in order to connect all
275           local clients that bypass local DNS APIs to systemd-resolved. This
276           file does not contain any search domains.
277
278       ·   systemd-resolved maintains the /run/systemd/resolve/resolv.conf
279           file for compatibility with traditional Linux programs. This file
280           may be symlinked from /etc/resolv.conf and is always kept
281           up-to-date, containing information about all known DNS servers.
282           Note the file format's limitations: it does not know a concept of
283           per-interface DNS servers and hence only contains system-wide DNS
284           server definitions. Note that /run/systemd/resolve/resolv.conf
285           should not be used directly by applications, but only through a
286           symlink from /etc/resolv.conf. If this mode of operation is used
287           local clients that bypass any local DNS API will also bypass
288           systemd-resolved and will talk directly to the known DNS servers.
289
290       ·   Alternatively, /etc/resolv.conf may be managed by other packages,
291           in which case systemd-resolved will read it for DNS configuration
292           data. In this mode of operation systemd-resolved is consumer rather
293           than provider of this configuration file.
294
295       Note that the selected mode of operation for this file is detected
296       fully automatically, depending on whether /etc/resolv.conf is a symlink
297       to /run/systemd/resolve/resolv.conf or lists 127.0.0.53 as DNS server.
298

SIGNALS

300       SIGUSR1
301           Upon reception of the SIGUSR1 process signal systemd-resolved will
302           dump the contents of all DNS resource record caches it maintains,
303           as well as all feature level information it learnt about configured
304           DNS servers into the system logs.
305
306       SIGUSR2
307           Upon reception of the SIGUSR2 process signal systemd-resolved will
308           flush all caches it maintains. Note that it should normally not be
309           necessary to request this explicitly – except for debugging
310           purposes – as systemd-resolved flushes the caches automatically
311           anyway any time the host's network configuration changes. Sending
312           this signal to systemd-resolved is equivalent to the resolvectl
313           flush-caches command, however the latter is recommended since it
314           operates in a synchronous way.
315
316       SIGRTMIN+1
317           Upon reception of the SIGRTMIN+1 process signal systemd-resolved
318           will forget everything it learnt about the configured DNS servers.
319           Specifically any information about server feature support is
320           flushed out, and the server feature probing logic is restarted on
321           the next request, starting with the most fully featured level. Note
322           that it should normally not be necessary to request this explicitly
323           – except for debugging purposes – as systemd-resolved automatically
324           forgets learnt information any time the DNS server configuration
325           changes. Sending this signal to systemd-resolved is equivalent to
326           the resolvectl reset-server-features command, however the latter is
327           recommended since it operates in a synchronous way.
328

SEE ALSO

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

NOTES

335        1. RFC3493
336           https://tools.ietf.org/html/rfc3493
337
338        2. RFC6762
339           https://tools.ietf.org/html/rfc6762
340
341        3. resolved D-Bus API Documentation
342           https://www.freedesktop.org/wiki/Software/systemd/resolved
343
344
345
346systemd 246                                        SYSTEMD-RESOLVED.SERVICE(8)
Impressum