Debian Codegraph @

upstream/debian-trixie/man8/systemd-resolved.service.8

raw
1 '\" t
2 .TH "SYSTEMD\-RESOLVED\&.SERVICE" "8" "" "systemd 257.13" "systemd-resolved.service"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 systemd-resolved.service, systemd-resolved \- Network Name Resolution manager
24 .SH "SYNOPSIS"
25 .PP
26 systemd\-resolved\&.service
27 .PP
28 /usr/lib/systemd/systemd\-resolved
29 .SH "DESCRIPTION"
30 .PP
31 \fBsystemd\-resolved\fR
32 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 and MulticastDNS resolver and responder\&. Local applications may submit network name resolution requests via three interfaces:
33 .sp
34 .RS 4
35 .ie n \{\
36 \h'-04'\(bu\h'+03'\c
37 .\}
38 .el \{\
39 .sp -1
40 .IP \(bu 2.3
41 .\}
42 The native, fully\-featured API
43 \fBsystemd\-resolved\fR
44 exposes via D\-Bus, see
45 \fBorg.freedesktop.resolve1\fR(5)
46 and
47 \fBorg.freedesktop.LogControl1\fR(5)
48 for details\&. Usage of this API is generally recommended to clients as it is asynchronous and fully featured (for example, properly returns DNSSEC validation status and interface scope for addresses as necessary for supporting link\-local networking)\&.
49 .RE
50 .sp
51 .RS 4
52 .ie n \{\
53 \h'-04'\(bu\h'+03'\c
54 .\}
55 .el \{\
56 .sp -1
57 .IP \(bu 2.3
58 .\}
59 The native API
60 \fBsystemd\-resolved\fR
61 exposes via Varlink on the
62 /run/systemd/resolve/io\&.systemd\&.Resolve
63 AF_UNIX socket\&. This provides similar functionality as the D\-Bus interface, but is available during the entire runtime, without requiring a running D\-Bus system bus broker service\&.
64 .RE
65 .sp
66 .RS 4
67 .ie n \{\
68 \h'-04'\(bu\h'+03'\c
69 .\}
70 .el \{\
71 .sp -1
72 .IP \(bu 2.3
73 .\}
74 The glibc
75 \fBgetaddrinfo\fR(3)
76 API as defined by
77 \m[blue]\fBRFC3493\fR\m[]\&\s-2\u[1]\d\s+2
78 and its related resolver functions, including
79 \fBgethostbyname\fR(3)\&. This API is widely supported, including beyond the Linux platform\&. In its current form it does not expose DNSSEC validation status information however, and is synchronous only\&. This API is backed by the glibc Name Service Switch (\fBnss\fR(5))\&. Usage of the glibc NSS module
80 \fBnss-resolve\fR(8)
81 is required in order to allow glibc\*(Aqs NSS resolver functions to resolve hostnames via
82 \fBsystemd\-resolved\fR\&.
83 .RE
84 .sp
85 .RS 4
86 .ie n \{\
87 \h'-04'\(bu\h'+03'\c
88 .\}
89 .el \{\
90 .sp -1
91 .IP \(bu 2.3
92 .\}
93 Additionally,
94 \fBsystemd\-resolved\fR
95 provides a local DNS stub listener on the IP addresses 127\&.0\&.0\&.53 and 127\&.0\&.0\&.54 on the local loopback interface\&. Programs issuing DNS requests directly, bypassing any local API may be directed to this stub, in order to connect them to
96 \fBsystemd\-resolved\fR\&. Note however that it is strongly recommended that local programs use the glibc NSS or bus APIs instead (as described above), as various network resolution concepts (such as link\-local addressing, or LLMNR Unicode domains) cannot be mapped to the unicast DNS protocol\&.
97 .sp
98 The DNS stub resolver on 127\&.0\&.0\&.53 provides the full feature set of the local resolver, which includes offering LLMNR/MulticastDNS resolution\&. The DNS stub resolver on 127\&.0\&.0\&.54 provides a more limited resolver, that operates in "proxy" mode only, i\&.e\&. it will pass most DNS messages relatively unmodified to the current upstream DNS servers and back, but not try to process the messages locally, and hence does not validate DNSSEC, or offer up LLMNR/MulticastDNS\&. (It will translate to DNS\-over\-TLS communication if needed however\&.)
99 .RE
100 .PP
101 The DNS servers contacted are determined from the global settings in
102 /etc/systemd/resolved\&.conf, the per\-link static settings in
103 /etc/systemd/network/*\&.network
104 files (in case
105 \fBsystemd-networkd.service\fR(8)
106 is used), the per\-link dynamic settings received over DHCP, information provided via
107 \fBresolvectl\fR(1), and any DNS server information made available by other system services\&. See
108 \fBresolved.conf\fR(5)
109 and
110 \fBsystemd.network\fR(5)
111 for details about systemd\*(Aqs own configuration files for DNS servers\&. To improve compatibility,
112 /etc/resolv\&.conf
113 is read in order to discover configured system DNS servers, but only if it is not a symlink to
114 /run/systemd/resolve/stub\-resolv\&.conf,
115 /usr/lib/systemd/resolv\&.conf
116 or
117 /run/systemd/resolve/resolv\&.conf
118 (see below)\&.
119 .SH "SYNTHETIC RECORDS"
120 .PP
121 \fBsystemd\-resolved\fR
122 synthesizes DNS resource records (RRs) for the following cases:
123 .sp
124 .RS 4
125 .ie n \{\
126 \h'-04'\(bu\h'+03'\c
127 .\}
128 .el \{\
129 .sp -1
130 .IP \(bu 2.3
131 .\}
132 The local, configured hostname is resolved to all locally configured IP addresses ordered by their scope, or \(em if none are configured \(em the IPv4 address 127\&.0\&.0\&.2 (which is on the local loopback interface) and the IPv6 address ::1 (which is the local host)\&.
133 .RE
134 .sp
135 .RS 4
136 .ie n \{\
137 \h'-04'\(bu\h'+03'\c
138 .\}
139 .el \{\
140 .sp -1
141 .IP \(bu 2.3
142 .\}
143 The hostnames
144 "localhost"
145 and
146 "localhost\&.localdomain"
147 as well as any hostname ending in
148 "\&.localhost"
149 or
150 "\&.localhost\&.localdomain"
151 are resolved to the IP addresses 127\&.0\&.0\&.1 and ::1\&.
152 .RE
153 .sp
154 .RS 4
155 .ie n \{\
156 \h'-04'\(bu\h'+03'\c
157 .\}
158 .el \{\
159 .sp -1
160 .IP \(bu 2.3
161 .\}
162 The hostname
163 "_gateway"
164 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\&.
165 .RE
166 .sp
167 .RS 4
168 .ie n \{\
169 \h'-04'\(bu\h'+03'\c
170 .\}
171 .el \{\
172 .sp -1
173 .IP \(bu 2.3
174 .\}
175 The hostname
176 "_outbound"
177 is resolved to the local IPv4 and IPv6 addresses that are most likely used for communication with other hosts\&. This is the preferred source addresses of default gateways if specified, or determined by requesting a routing decision to the configured default gateways from the kernel and then using the local IP addresses selected by this decision\&. This hostname is only available if there is at least one local default gateway configured\&. This assigns a stable hostname to the local outbound IP addresses, useful for referencing them independently of the current network configuration state\&.
178 .RE
179 .sp
180 .RS 4
181 .ie n \{\
182 \h'-04'\(bu\h'+03'\c
183 .\}
184 .el \{\
185 .sp -1
186 .IP \(bu 2.3
187 .\}
188 The hostname
189 "_localdnsstub"
190 is resolved to the IP address 127\&.0\&.0\&.53, i\&.e\&. the address the local DNS stub (see above) is listening on\&.
191 .RE
192 .sp
193 .RS 4
194 .ie n \{\
195 \h'-04'\(bu\h'+03'\c
196 .\}
197 .el \{\
198 .sp -1
199 .IP \(bu 2.3
200 .\}
201 The hostname
202 "_localdnsproxy"
203 is resolved to the IP address 127\&.0\&.0\&.54, i\&.e\&. the address the local DNS proxy (see above) is listening on\&.
204 .RE
205 .sp
206 .RS 4
207 .ie n \{\
208 \h'-04'\(bu\h'+03'\c
209 .\}
210 .el \{\
211 .sp -1
212 .IP \(bu 2.3
213 .\}
214 The mappings defined in
215 /etc/hosts
216 are resolved to their configured addresses and back, but they will not affect lookups for non\-address types (like MX)\&. Support for
217 /etc/hosts
218 may be disabled with
219 \fIReadEtcHosts=no\fR, see
220 \fBresolved.conf\fR(5)\&.
221 .RE
222 .SH "PROTOCOLS AND ROUTING"
223 .PP
224 The lookup requests that
225 systemd\-resolved\&.service
226 receives are routed to the available DNS servers, LLMNR, and MulticastDNS interfaces according to the following rules:
227 .sp
228 .RS 4
229 .ie n \{\
230 \h'-04'\(bu\h'+03'\c
231 .\}
232 .el \{\
233 .sp -1
234 .IP \(bu 2.3
235 .\}
236 Names for which synthetic records are generated (the local hostname,
237 "localhost"
238 and
239 "localdomain", local gateway, as listed in the previous section) and addresses configured in
240 /etc/hosts
241 are never routed to the network and a reply is sent immediately\&.
242 .RE
243 .sp
244 .RS 4
245 .ie n \{\
246 \h'-04'\(bu\h'+03'\c
247 .\}
248 .el \{\
249 .sp -1
250 .IP \(bu 2.3
251 .\}
252 Single\-label names are resolved using LLMNR on all local interfaces where LLMNR is enabled\&. Lookups for IPv4 addresses are only sent via LLMNR on IPv4, and lookups for IPv6 addresses are only sent via LLMNR on IPv6\&. Note that lookups for single\-label synthesized names are not routed to LLMNR, MulticastDNS or unicast DNS\&.
253 .RE
254 .sp
255 .RS 4
256 .ie n \{\
257 \h'-04'\(bu\h'+03'\c
258 .\}
259 .el \{\
260 .sp -1
261 .IP \(bu 2.3
262 .\}
263 Queries for the address records (A and AAAA) of single\-label non\-synthesized names are resolved via unicast DNS using search domains\&. For any interface which defines search domains, such look\-ups are routed to the servers defined for that interface, suffixed with each of those search domains\&. When global search domains are defined, such look\-ups are routed to the global servers\&. For each search domain, queries are performed by suffixing the name with each of the search domains in turn\&. Additionally, lookup of single\-label names via unicast DNS may be enabled with the
264 \fIResolveUnicastSingleLabel=yes\fR
265 setting\&. The details of which servers are queried and how the final reply is chosen are described below\&. Note that this means that address queries for single\-label names are never sent out to remote DNS servers by default, and resolution is only possible if search domains are defined\&.
266 .RE
267 .sp
268 .RS 4
269 .ie n \{\
270 \h'-04'\(bu\h'+03'\c
271 .\}
272 .el \{\
273 .sp -1
274 .IP \(bu 2.3
275 .\}
276 Multi\-label names with the domain suffix
277 "\&.local"
278 are resolved using MulticastDNS on all local interfaces where MulticastDNS is enabled\&. As with LLMNR, IPv4 address lookups are sent via IPv4 and IPv6 address lookups are sent via IPv6\&.
279 .RE
280 .sp
281 .RS 4
282 .ie n \{\
283 \h'-04'\(bu\h'+03'\c
284 .\}
285 .el \{\
286 .sp -1
287 .IP \(bu 2.3
288 .\}
289 Queries for multi\-label names are routed via unicast DNS on local interfaces that have a DNS server configured, plus the globally configured DNS servers if there are any\&. Which interfaces are used is determined by the routing logic based on search and route\-only domains, described below\&. Note that by default, lookups for domains with the
290 "\&.local"
291 suffix are not routed to DNS servers, unless the domain is specified explicitly as routing or search domain for the DNS server and interface\&. This means that on networks where the
292 "\&.local"
293 domain is defined in a site\-specific DNS server, explicit search or routing domains need to be configured to make lookups work within this DNS domain\&. Note that these days, it is generally recommended to avoid defining
294 "\&.local"
295 in a DNS server, as
296 \m[blue]\fBRFC6762\fR\m[]\&\s-2\u[2]\d\s+2
297 reserves this domain for exclusive MulticastDNS use\&.
298 .RE
299 .sp
300 .RS 4
301 .ie n \{\
302 \h'-04'\(bu\h'+03'\c
303 .\}
304 .el \{\
305 .sp -1
306 .IP \(bu 2.3
307 .\}
308 Address lookups (reverse lookups) are routed similarly to multi\-label names, with the exception that addresses from the link\-local address range are never routed to unicast DNS and are only resolved using LLMNR and MulticastDNS (when enabled)\&.
309 .RE
310 .PP
311 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\&.
312 .PP
313 Routing of lookups is determined by the per\-interface routing domains (search and route\-only) and global search domains\&. See
314 \fBsystemd.network\fR(5)
315 and
316 \fBresolvectl\fR(1)
317 for a description how those settings are set dynamically and the discussion of
318 \fIDomains=\fR
319 in
320 \fBresolved.conf\fR(5)
321 for a description of globally configured DNS settings\&.
322 .PP
323 The following query routing logic applies for unicast DNS lookups initiated by
324 systemd\-resolved\&.service:
325 .sp
326 .RS 4
327 .ie n \{\
328 \h'-04'\(bu\h'+03'\c
329 .\}
330 .el \{\
331 .sp -1
332 .IP \(bu 2.3
333 .\}
334 If a name to look up matches (that is: is equal to or has as suffix) any of the configured routing domains (search or route\-only) of any link, or the globally configured DNS settings, "best matching" routing domain is determined: the matching one with the most labels\&. The query is then sent to all DNS servers of any links or the globally configured DNS servers associated with this "best matching" routing domain\&. (Note that more than one link might have this same "best matching" routing domain configured, in which case the query is sent to all of them in parallel)\&.
335 .sp
336 In case of single\-label names, when search domains are defined, the same logic applies, except that the name is first suffixed by each of the search domains in turn\&. Note that this search logic does not apply to any names with at least one dot\&. Also see the discussion about compatibility with the traditional glibc resolver below\&.
337 .RE
338 .sp
339 .RS 4
340 .ie n \{\
341 \h'-04'\(bu\h'+03'\c
342 .\}
343 .el \{\
344 .sp -1
345 .IP \(bu 2.3
346 .\}
347 If a query does not match any configured routing domain (either per\-link or global), it is sent to all DNS servers that are configured on links configured as the default route, as well as the globally configured DNS server\&.
348 .RE
349 .sp
350 .RS 4
351 .ie n \{\
352 \h'-04'\(bu\h'+03'\c
353 .\}
354 .el \{\
355 .sp -1
356 .IP \(bu 2.3
357 .\}
358 If there are no DNS servers configured on any link also configured as the default route and no global DNS server configured, one of the compiled\-in fallback DNS servers is used\&.
359 .RE
360 .sp
361 .RS 4
362 .ie n \{\
363 \h'-04'\(bu\h'+03'\c
364 .\}
365 .el \{\
366 .sp -1
367 .IP \(bu 2.3
368 .\}
369 Otherwise, the unicast DNS query fails, as no suitable DNS servers can be determined\&.
370 .RE
371 .PP
372 Whether a link is the default route or not can be configured with
373 \fBresolvectl default\-route\fR
374 command or
375 \fIDNSDefaultRoute=\fR
376 setting in
377 \&.network
378 files\&. If not configured explicitly, it is implicitly determined based on the configured DNS domains for a link: if there\*(Aqs a route\-only domain other than
379 "~\&.", it defaults to false, otherwise to true\&.
380 .PP
381 Effectively this means: in order to support single\-label non\-synthesized names, define appropriate search domains\&. In order to preferably route all DNS queries not explicitly matched by routing domain configuration to a specific link, configure a
382 "~\&."
383 route\-only domain on it\&. This will ensure that other links will not be considered for these queries (unless they too carry such a routing domain)\&. In order to route all such DNS queries to a specific link only if no other link is preferred, configure the link as the default route and do not configure a
384 "~\&."
385 route\-only domain on it\&. Finally, in order to avoid a specific link receiving any DNS traffic not matching any of its configured routing domains, do not make it a default route\&.
386 .PP
387 See
388 \fBorg.freedesktop.resolve1\fR(5)
389 for information about the D\-Bus APIs
390 \fBsystemd\-resolved\fR
391 provides\&.
392 .SH "COMPATIBILITY WITH THE TRADITIONAL GLIBC STUB RESOLVER"
393 .PP
394 This section provides a short summary of differences in the resolver implemented by
395 \fBnss-resolve\fR(8)
396 together with
397 \fBsystemd\-resolved\fR
398 and the traditional stub resolver implemented in
399 nss\-dns\&.
400 .sp
401 .RS 4
402 .ie n \{\
403 \h'-04'\(bu\h'+03'\c
404 .\}
405 .el \{\
406 .sp -1
407 .IP \(bu 2.3
408 .\}
409 Some names are always resolved internally (see Synthetic Records above)\&. Traditionally they would be resolved by
410 nss\-files
411 if provided in
412 /etc/hosts\&. But note that the details of how a query is constructed are under the control of the client library\&.
413 nss\-dns
414 will first try to resolve names using search domains and even if those queries are routed to
415 systemd\-resolved, it will send them out over the network using the usual rules for multi\-label name routing
416 \&\s-2\u[3]\d\s+2\&.
417 .RE
418 .sp
419 .RS 4
420 .ie n \{\
421 \h'-04'\(bu\h'+03'\c
422 .\}
423 .el \{\
424 .sp -1
425 .IP \(bu 2.3
426 .\}
427 Single\-label names are not resolved for A and AAAA records using unicast DNS (unless overridden with
428 \fIResolveUnicastSingleLabel=\fR, see
429 \fBresolved.conf\fR(5))\&. This is similar to the
430 \fBno\-tld\-query\fR
431 option being set in
432 \fBresolv.conf\fR(5)\&.
433 .RE
434 .sp
435 .RS 4
436 .ie n \{\
437 \h'-04'\(bu\h'+03'\c
438 .\}
439 .el \{\
440 .sp -1
441 .IP \(bu 2.3
442 .\}
443 Search domains are not used for
444 \fIsuffixing\fR
445 of multi\-label names\&. (Search domains are nevertheless used for lookup
446 \fIrouting\fR, for names that were originally specified as single\-label or multi\-label\&.) Any name with at least one dot is always interpreted as a FQDN\&.
447 nss\-dns
448 would resolve names both as relative (using search domains) and absolute FQDN names\&. Some names would be resolved as relative first, and after that query has failed, as absolute, while other names would be resolved in opposite order\&. The
449 \fIndots\fR
450 option in
451 /etc/resolv\&.conf
452 was used to control how many dots the name needs to have to be resolved as relative first\&. This stub resolver does not implement this at all: multi\-label names are only resolved as FQDNs\&.\&\s-2\u[4]\d\s+2
453 .RE
454 .sp
455 .RS 4
456 .ie n \{\
457 \h'-04'\(bu\h'+03'\c
458 .\}
459 .el \{\
460 .sp -1
461 .IP \(bu 2.3
462 .\}
463 This resolver has a notion of the special
464 "\&.local"
465 domain used for MulticastDNS, and will not route queries with that suffix to unicast DNS servers unless explicitly configured, see above\&. Also, reverse lookups for link\-local addresses are not sent to unicast DNS servers\&.
466 .RE
467 .sp
468 .RS 4
469 .ie n \{\
470 \h'-04'\(bu\h'+03'\c
471 .\}
472 .el \{\
473 .sp -1
474 .IP \(bu 2.3
475 .\}
476 This resolver reads and caches
477 /etc/hosts
478 internally\&. (In other words,
479 nss\-resolve
480 replaces
481 nss\-files
482 in addition to
483 nss\-dns)\&. Entries in
484 /etc/hosts
485 have highest priority\&.
486 .RE
487 .sp
488 .RS 4
489 .ie n \{\
490 \h'-04'\(bu\h'+03'\c
491 .\}
492 .el \{\
493 .sp -1
494 .IP \(bu 2.3
495 .\}
496 This resolver also implements LLMNR and MulticastDNS in addition to the classic unicast DNS protocol, and will resolve single\-label names using LLMNR (when enabled) and names ending in
497 "\&.local"
498 using MulticastDNS (when enabled)\&.
499 .RE
500 .sp
501 .RS 4
502 .ie n \{\
503 \h'-04'\(bu\h'+03'\c
504 .\}
505 .el \{\
506 .sp -1
507 .IP \(bu 2.3
508 .\}
509 Environment variables
510 \fI$LOCALDOMAIN\fR
511 and
512 \fI$RES_OPTIONS\fR
513 described in
514 \fBresolv.conf\fR(5)
515 are not supported currently\&.
516 .RE
517 .sp
518 .RS 4
519 .ie n \{\
520 \h'-04'\(bu\h'+03'\c
521 .\}
522 .el \{\
523 .sp -1
524 .IP \(bu 2.3
525 .\}
526 The
527 nss\-dns
528 resolver maintains little state between subsequent DNS queries, and for each query always talks to the first listed DNS server from
529 /etc/resolv\&.conf
530 first, and on failure continues with the next until reaching the end of the list which is when the query fails\&. The resolver in
531 \fBsystemd\-resolved\fR
532 however maintains state, and will continuously talk to the same server for all queries in a particular lookup scope until some form of error is seen at which point it will switch to the next server, and then stay with it for all queries on the scope until the next failure, and so on, eventually returning to the first configured server\&. This is done to optimize lookup times, in particular given that the resolver typically must first probe server feature sets when talking to a server, which takes time\&. This different behaviour implies that listed DNS servers per lookup scope must be equivalent in the zones they serve, so that sending a query to one of them will yield the same results as sending it to another configured DNS server\&.
533 .RE
534 .SH "/ETC/RESOLV\&.CONF"
535 .PP
536 Four modes of handling
537 /etc/resolv\&.conf
538 (see
539 \fBresolv.conf\fR(5)) are supported:
540 .sp
541 .RS 4
542 .ie n \{\
543 \h'-04'\(bu\h'+03'\c
544 .\}
545 .el \{\
546 .sp -1
547 .IP \(bu 2.3
548 .\}
549 \fBsystemd\-resolved\fR
550 maintains the
551 /run/systemd/resolve/stub\-resolv\&.conf
552 file for compatibility with traditional Linux programs\&. This file lists the 127\&.0\&.0\&.53 DNS stub (see above) as the only DNS server\&. It also contains a list of search domains that are in use by
553 \fBsystemd\-resolved\fR\&. The list of search domains is always kept up\-to\-date\&. Note that
554 /run/systemd/resolve/stub\-resolv\&.conf
555 should not be used directly by applications, but only through a symlink from
556 /etc/resolv\&.conf\&. This file may be symlinked from
557 /etc/resolv\&.conf
558 in order to connect all local clients that bypass local DNS APIs to
559 \fBsystemd\-resolved\fR
560 with correct search domains settings\&. This mode of operation is recommended\&.
561 .RE
562 .sp
563 .RS 4
564 .ie n \{\
565 \h'-04'\(bu\h'+03'\c
566 .\}
567 .el \{\
568 .sp -1
569 .IP \(bu 2.3
570 .\}
571 A static file
572 /usr/lib/systemd/resolv\&.conf
573 is provided that lists the 127\&.0\&.0\&.53 DNS stub (see above) as only DNS server\&. This file may be symlinked from
574 /etc/resolv\&.conf
575 in order to connect all local clients that bypass local DNS APIs to
576 \fBsystemd\-resolved\fR\&. This file does not contain any search domains\&.
577 .RE
578 .sp
579 .RS 4
580 .ie n \{\
581 \h'-04'\(bu\h'+03'\c
582 .\}
583 .el \{\
584 .sp -1
585 .IP \(bu 2.3
586 .\}
587 \fBsystemd\-resolved\fR
588 maintains the
589 /run/systemd/resolve/resolv\&.conf
590 file for compatibility with traditional Linux programs\&. This file may be symlinked from
591 /etc/resolv\&.conf
592 and is always kept up\-to\-date, containing information about all known DNS servers\&. Note the file format\*(Aqs limitations: it does not know a concept of per\-interface DNS servers and hence only contains system\-wide DNS server definitions\&. Note that
593 /run/systemd/resolve/resolv\&.conf
594 should not be used directly by applications, but only through a symlink from
595 /etc/resolv\&.conf\&. If this mode of operation is used local clients that bypass any local DNS API will also bypass
596 \fBsystemd\-resolved\fR
597 and will talk directly to the known DNS servers\&.
598 .RE
599 .sp
600 .RS 4
601 .ie n \{\
602 \h'-04'\(bu\h'+03'\c
603 .\}
604 .el \{\
605 .sp -1
606 .IP \(bu 2.3
607 .\}
608 Alternatively,
609 /etc/resolv\&.conf
610 may be managed by other packages, in which case
611 \fBsystemd\-resolved\fR
612 will read it for DNS configuration data\&. In this mode of operation
613 \fBsystemd\-resolved\fR
614 is consumer rather than provider of this configuration file\&.
615 .RE
616 .PP
617 Note that the selected mode of operation for this file is detected fully automatically, depending on whether
618 /etc/resolv\&.conf
619 is a symlink to
620 /run/systemd/resolve/resolv\&.conf
621 or lists 127\&.0\&.0\&.53 as DNS server\&.
622 .SH "SIGNALS"
623 .PP
624 \fBSIGUSR1\fR
625 .RS 4
626 Upon reception of the
627 \fBSIGUSR1\fR
628 process signal
629 \fBsystemd\-resolved\fR
630 will dump the contents of all DNS resource record caches it maintains, as well as all feature level information it learnt about configured DNS servers into the system logs\&.
631 .sp
632 Added in version 231\&.
633 .RE
634 .PP
635 \fBSIGUSR2\fR
636 .RS 4
637 Upon reception of the
638 \fBSIGUSR2\fR
639 process signal
640 \fBsystemd\-resolved\fR
641 will flush all caches it maintains\&. Note that it should normally not be necessary to request this explicitly \(en except for debugging purposes \(en as
642 \fBsystemd\-resolved\fR
643 flushes the caches automatically anyway any time the host\*(Aqs network configuration changes\&. Sending this signal to
644 \fBsystemd\-resolved\fR
645 is equivalent to the
646 \fBresolvectl flush\-caches\fR
647 command, however the latter is recommended since it operates in a synchronous way\&.
648 .sp
649 Added in version 231\&.
650 .RE
651 .PP
652 \fBSIGRTMIN+1\fR
653 .RS 4
654 Upon reception of the
655 \fBSIGRTMIN+1\fR
656 process signal
657 \fBsystemd\-resolved\fR
658 will forget everything it learnt about the configured DNS servers\&. Specifically any information about server feature support is flushed out, and the server feature probing logic is restarted on the next request, starting with the most fully featured level\&. Note that it should normally not be necessary to request this explicitly \(en except for debugging purposes \(en as
659 \fBsystemd\-resolved\fR
660 automatically forgets learnt information any time the DNS server configuration changes\&. Sending this signal to
661 \fBsystemd\-resolved\fR
662 is equivalent to the
663 \fBresolvectl reset\-server\-features\fR
664 command, however the latter is recommended since it operates in a synchronous way\&.
665 .sp
666 Added in version 235\&.
667 .RE
668 .PP
669 \fBSIGHUP\fR
670 .RS 4
671 Upon reception of the
672 \fBSIGHUP\fR
673 process signal
674 \fBsystemd\-resolved\fR
675 will flush all caches it maintains, drop all open TCP connections (if any), and reload its configuration files\&.
676 .sp
677 Added in version 256\&.
678 .RE
679 .SH "CREDENTIALS"
680 .PP
681 \fBsystemd\-resolved\fR
682 supports the service credentials logic as implemented by
683 \fIImportCredential=\fR/\fILoadCredential=\fR/\fISetCredential=\fR
684 (see
685 \fBsystemd.exec\fR(5)
686 for details)\&. The following credentials are used when passed in:
687 .PP
688 \fInetwork\&.dns\fR, \fInetwork\&.search_domains\fR
689 .RS 4
690 May contain a space separated list of DNS server IP addresses and DNS search domains\&. This information is only used when no explicit configuration via
691 /etc/systemd/resolved\&.conf,
692 /etc/resolv\&.conf
693 or the kernel command line has been provided\&.
694 .sp
695 Added in version 253\&.
696 .RE
697 .SH "KERNEL COMMAND LINE"
698 .PP
699 \fBsystemd\-resolved\fR
700 also honours two kernel command line options:
701 .PP
702 \fInameserver=\fR, \fIdomain=\fR
703 .RS 4
704 Takes the IP address of a DNS server (in case of
705 \fInameserver=\fR), and a DNS search domain (in case of
706 \fIdomain=\fR)\&. May be used multiple times, to define multiple DNS servers/search domains\&. If either of these options are specified
707 /etc/resolv\&.conf
708 will not be read and the
709 \fIDNS=\fR
710 and
711 \fIDomains=\fR
712 settings of
713 \fBresolved.conf\fR(5)
714 will be ignored\&. These two kernel command line options hence override system configuration\&.
715 .sp
716 Added in version 253\&.
717 .RE
718 .SH "IP PORTS"
719 .PP
720 The
721 \fBsystemd\-resolved\fR
722 service listens on the following IP ports:
723 .sp
724 .RS 4
725 .ie n \{\
726 \h'-04'\(bu\h'+03'\c
727 .\}
728 .el \{\
729 .sp -1
730 .IP \(bu 2.3
731 .\}
732 Port 53 on IPv4 addresses 127\&.0\&.0\&.53 and 127\&.0\&.0\&.54 (both are on the local loopback interface
733 "lo")\&. This is the local DNS stub, as discussed above\&. Both UDP and TCP are covered\&.
734 .RE
735 .sp
736 .RS 4
737 .ie n \{\
738 \h'-04'\(bu\h'+03'\c
739 .\}
740 .el \{\
741 .sp -1
742 .IP \(bu 2.3
743 .\}
744 Port 5353 on all local addresses, both IPv4 and IPv6 (0\&.0\&.0\&.0 and ::0), for MulticastDNS on UDP\&. Note that even though the socket is bound to all local interfaces via the selected "wildcard" IP addresses, the incoming datagrams are filtered by the network interface they are coming in on, and separate MulticastDNS link\-local scopes are maintained for each, taking into consideration whether MulticastDNS is enabled for the interface or not\&.
745 .RE
746 .sp
747 .RS 4
748 .ie n \{\
749 \h'-04'\(bu\h'+03'\c
750 .\}
751 .el \{\
752 .sp -1
753 .IP \(bu 2.3
754 .\}
755 Port 5355 on all local addresses, both IPv4 and IP6 (0\&.0\&.0\&.0 and ::0), for LLMNR, on both TCP and UDP\&. As with MulticastDNS filtering by incoming network interface is applied\&.
756 .RE
757 .SH "SEE ALSO"
758 .PP
759 \fBsystemd\fR(1), \fBresolved.conf\fR(5), \fBdnssec-trust-anchors.d\fR(5), \fBnss-resolve\fR(8), \fBresolvectl\fR(1), \fBresolv.conf\fR(5), \fBhosts\fR(5), \fBsystemd.network\fR(5), \fBsystemd-networkd.service\fR(8), \fBorg.freedesktop.resolve1\fR(5)
760 .SH "NOTES"
761 .IP " 1." 4
762 RFC3493
763 .RS 4
764 \%https://tools.ietf.org/html/rfc3493
765 .RE
766 .IP " 2." 4
767 RFC6762
768 .RS 4
769 \%https://tools.ietf.org/html/rfc6762
770 .RE
771 .IP " 3." 4
772 For example, if
773 /etc/resolv.conf
774 has
775 .sp
776 .RS 4
777 .if n \{\
778 .RS 4
779 .\}
780 .nf
781 nameserver 127.0.0.53
782 search foobar.com barbar.com
783 .fi
784 .if n \{\
785 .RE
786 .\}
787 .sp
788 and we look up
789 "localhost",
790 nss-dns
791 will send the following queries to
792 systemd-resolved
793 listening on 127.0.0.53:53: first
794 "localhost.foobar.com", then
795 "localhost.barbar.com", and finally
796 "localhost". If (hopefully) the first two queries fail,
797 systemd-resolved
798 will synthesize an answer for the third query.
799 .RE
800 .sp
801 .RS 4n
802 When using
803 nss-dns
804 with any search domains, it is thus crucial to always configure
805 nss-files
806 with higher priority and provide mappings for names that should not be resolved using search domains.
807 .RE
808 .IP " 4." 4
809 There are currently more than 1500 top-level domain names defined, and new ones are added regularly, often using "attractive" names that are also likely to be used locally. Not looking up multi-label names in this fashion avoids fragility in both directions: a valid global name could be obscured by a local name, and resolution of a relative local name could suddenly break when a new top-level domain is created, or when a new subdomain of a top-level domain in registered. Resolving any given name as either relative or absolute avoids this ambiguity.
810