]>
Commit | Line | Data |
---|---|---|
514094f9 | 1 | <?xml version='1.0'?> |
091a364c | 2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
12b42c76 | 3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
091a364c TG |
4 | |
5 | <!-- | |
572eb058 | 6 | SPDX-License-Identifier: LGPL-2.1+ |
091a364c TG |
7 | --> |
8 | ||
1ec57f33 | 9 | <refentry id="systemd-resolved.service" conditional='ENABLE_RESOLVE'> |
091a364c | 10 | |
798d3a52 ZJS |
11 | <refentryinfo> |
12 | <title>systemd-resolved.service</title> | |
13 | <productname>systemd</productname> | |
798d3a52 ZJS |
14 | </refentryinfo> |
15 | ||
16 | <refmeta> | |
17 | <refentrytitle>systemd-resolved.service</refentrytitle> | |
18 | <manvolnum>8</manvolnum> | |
19 | </refmeta> | |
20 | ||
21 | <refnamediv> | |
22 | <refname>systemd-resolved.service</refname> | |
23 | <refname>systemd-resolved</refname> | |
24 | <refpurpose>Network Name Resolution manager</refpurpose> | |
25 | </refnamediv> | |
26 | ||
27 | <refsynopsisdiv> | |
28 | <para><filename>systemd-resolved.service</filename></para> | |
12b42c76 | 29 | <para><filename>/usr/lib/systemd/systemd-resolved</filename></para> |
798d3a52 ZJS |
30 | </refsynopsisdiv> |
31 | ||
32 | <refsect1> | |
33 | <title>Description</title> | |
34 | ||
624993ac | 35 | <para><command>systemd-resolved</command> is a system service that provides network name resolution to local |
6cdf635d LP |
36 | applications. It implements a caching and validating DNS/DNSSEC stub resolver, as well as an LLMNR and MulticastDNS |
37 | resolver and responder. Local applications may submit network name resolution requests via three interfaces:</para> | |
b541146b LP |
38 | |
39 | <itemizedlist> | |
40 | <listitem><para>The native, fully-featured API <command>systemd-resolved</command> exposes on the bus. See the | |
28a0ad81 | 41 | <ulink url="https://www.freedesktop.org/wiki/Software/systemd/resolved">API Documentation</ulink> for |
b541146b LP |
42 | details. Usage of this API is generally recommended to clients as it is asynchronous and fully featured (for |
43 | example, properly returns DNSSEC validation status and interface scope for addresses as necessary for supporting | |
44 | link-local networking).</para></listitem> | |
45 | ||
46 | <listitem><para>The glibc | |
0a07667d | 47 | <citerefentry project='man-pages'><refentrytitle>getaddrinfo</refentrytitle><manvolnum>3</manvolnum></citerefentry> API as defined |
fc549b96 | 48 | by <ulink url="https://tools.ietf.org/html/rfc3493">RFC3493</ulink> and its related resolver functions, |
0a07667d | 49 | including <citerefentry project='man-pages'><refentrytitle>gethostbyname</refentrytitle><manvolnum>3</manvolnum></citerefentry>. This |
b541146b LP |
50 | API is widely supported, including beyond the Linux platform. In its current form it does not expose DNSSEC |
51 | validation status information however, and is synchronous only. This API is backed by the glibc Name Service | |
0a07667d | 52 | Switch (<citerefentry project='man-pages'><refentrytitle>nss</refentrytitle><manvolnum>5</manvolnum></citerefentry>). Usage of the |
b541146b LP |
53 | glibc NSS module <citerefentry><refentrytitle>nss-resolve</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
54 | is required in order to allow glibc's NSS resolver functions to resolve host names via | |
55 | <command>systemd-resolved</command>.</para></listitem> | |
56 | ||
57 | <listitem><para>Additionally, <command>systemd-resolved</command> provides a local DNS stub listener on IP | |
58 | address 127.0.0.53 on the local loopback interface. Programs issuing DNS requests directly, bypassing any local | |
91fe95e1 LP |
59 | API may be directed to this stub, in order to connect them to <command>systemd-resolved</command>. Note however |
60 | that it is strongly recommended that local programs use the glibc NSS or bus APIs instead (as described above), | |
61 | as various network resolution concepts (such as link-local addressing, or LLMNR Unicode domains) cannot be mapped | |
62 | to the unicast DNS protocol.</para></listitem> | |
b541146b | 63 | </itemizedlist> |
798d3a52 | 64 | |
b541146b LP |
65 | <para>The DNS servers contacted are determined from the global settings in |
66 | <filename>/etc/systemd/resolved.conf</filename>, the per-link static settings in | |
6cdf635d LP |
67 | <filename>/etc/systemd/network/*.network</filename> files (in case |
68 | <citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> is | |
6561918f | 69 | used), the per-link dynamic settings received over DHCP, and any DNS server information made available by other |
6cdf635d | 70 | system services. See |
b541146b LP |
71 | <citerefentry><refentrytitle>resolved.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry> and |
72 | <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry> for details | |
73 | about systemd's own configuration files for DNS servers. To improve compatibility, | |
74 | <filename>/etc/resolv.conf</filename> is read in order to discover configured system DNS servers, but only if it is | |
e6b2d948 DJL |
75 | not a symlink to <filename>/run/systemd/resolve/stub-resolv.conf</filename> or |
76 | <filename>/run/systemd/resolve/resolv.conf</filename> (see below).</para> | |
b541146b LP |
77 | |
78 | <para><command>systemd-resolved</command> synthesizes DNS resource records (RRs) for the following cases:</para> | |
2dc6b11d LP |
79 | |
80 | <itemizedlist> | |
81 | <listitem><para>The local, configured hostname is resolved to | |
82 | all locally configured IP addresses ordered by their scope, or | |
83 | — if none are configured — the IPv4 address 127.0.0.2 (which | |
84 | is on the local loopback) and the IPv6 address ::1 (which is the | |
85 | local host).</para></listitem> | |
86 | ||
63003524 DH |
87 | <listitem><para>The hostnames <literal>localhost</literal> and |
88 | <literal>localhost.localdomain</literal> (as well as any hostname | |
89 | ending in <literal>.localhost</literal> or <literal>.localhost.localdomain</literal>) | |
90 | are resolved to the IP addresses 127.0.0.1 and ::1.</para></listitem> | |
2dc6b11d | 91 | |
30046d9c | 92 | <listitem><para>The hostname <literal>_gateway</literal> is |
2dc6b11d LP |
93 | resolved to all current default routing gateway addresses, |
94 | ordered by their metric. This assigns a stable hostname to the | |
95 | current gateway, useful for referencing it independently of the | |
96 | current network configuration state.</para></listitem> | |
394bac4f | 97 | |
4050e04b MP |
98 | <listitem><para>The mappings defined in <filename>/etc/hosts</filename> are resolved |
99 | to their configured addresses and back, but they will not affect lookups for | |
100 | non-address types (like MX).</para></listitem> | |
2dc6b11d LP |
101 | </itemizedlist> |
102 | ||
6cdf635d LP |
103 | <para>Lookup requests are routed to the available DNS servers, LLMNR and MulticastDNS interfaces according to the |
104 | following rules:</para> | |
2dc6b11d LP |
105 | |
106 | <itemizedlist> | |
6cdf635d LP |
107 | <listitem><para>Lookups for the special hostname <literal>localhost</literal> are never routed to the network. (A |
108 | few other, special domains are handled the same way.)</para></listitem> | |
109 | ||
110 | <listitem><para>Single-label names are routed to all local interfaces capable of IP multicasting, using the LLMNR | |
111 | protocol. Lookups for IPv4 addresses are only sent via LLMNR on IPv4, and lookups for IPv6 addresses are only | |
112 | sent via LLMNR on IPv6. Lookups for the locally configured host name and the <literal>_gateway</literal> host | |
113 | name are never routed to LLMNR.</para></listitem> | |
114 | ||
115 | <listitem><para>Multi-label names with the domain suffix <literal>.local</literal> are routed to all local | |
116 | interfaces capable of IP multicasting, using the MulticastDNS protocol. As with LLMNR IPv4 address lookups are | |
117 | sent via IPv4 and IPv6 address lookups are sent via IPv6.</para></listitem> | |
118 | ||
119 | <listitem><para>Other multi-label names are routed to all local interfaces that have a DNS server configured, | |
120 | plus the globally configured DNS server if there is one. Address lookups from the link-local address range are | |
121 | never routed to DNS. Note that by default lookups for domains with the <literal>.local</literal> suffix are not | |
122 | routed to DNS servers, unless the domain is specified explicitly as routing or search domain for the DNS server | |
123 | and interface. This means that on networks where the <literal>.local</literal> domain is defined in a | |
124 | site-specific DNS server, explicit search or routing domains need to be configured to make lookups within this | |
125 | DNS domain work. Note that today it's generally recommended to avoid defining <literal>.local</literal> in a DNS | |
126 | server, as <ulink url="https://tools.ietf.org/html/rfc6762">RFC6762</ulink> reserves this domain for exclusive | |
127 | MulticastDNS use.</para></listitem> | |
2dc6b11d LP |
128 | </itemizedlist> |
129 | ||
130 | <para>If lookups are routed to multiple interfaces, the first | |
131 | successful response is returned (thus effectively merging the | |
132 | lookup zones on all matching interfaces). If the lookup failed on | |
b938cb90 | 133 | all interfaces, the last failing response is returned.</para> |
2dc6b11d LP |
134 | |
135 | <para>Routing of lookups may be influenced by configuring | |
b938cb90 | 136 | per-interface domain names. See |
2dc6b11d LP |
137 | <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
138 | for details. Lookups for a hostname ending in one of the | |
139 | per-interface domains are exclusively routed to the matching | |
140 | interfaces.</para> | |
141 | ||
28a0ad81 | 142 | <para>See the <ulink url="https://www.freedesktop.org/wiki/Software/systemd/resolved"> resolved D-Bus API |
a0956ed0 LP |
143 | Documentation</ulink> for information about the APIs <filename>systemd-resolved</filename> provides.</para> |
144 | ||
798d3a52 ZJS |
145 | </refsect1> |
146 | ||
b541146b LP |
147 | <refsect1> |
148 | <title><filename>/etc/resolv.conf</filename></title> | |
149 | ||
e6b2d948 | 150 | <para>Four modes of handling <filename>/etc/resolv.conf</filename> (see |
0a07667d | 151 | <citerefentry project='man-pages'><refentrytitle>resolv.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>) are |
b541146b LP |
152 | supported:</para> |
153 | ||
154 | <itemizedlist> | |
e6b2d948 DJL |
155 | <listitem><para><command>systemd-resolved</command> maintains the |
156 | <filename>/run/systemd/resolve/stub-resolv.conf</filename> file for compatibility with traditional Linux | |
157 | programs. This file may be symlinked from <filename>/etc/resolv.conf</filename>. This file lists the 127.0.0.53 | |
158 | DNS stub (see above) as the only DNS server. It also contains a list of search domains that are in use by | |
159 | systemd-resolved. The list of search domains is always kept up-to-date. Note that | |
160 | <filename>/run/systemd/resolve/stub-resolv.conf</filename> should not be used directly by applications, but only | |
161 | through a symlink from <filename>/etc/resolv.conf</filename>. This file may be symlinked from | |
162 | <filename>/etc/resolv.conf</filename> in order to connect all local clients that bypass local DNS APIs to | |
163 | <command>systemd-resolved</command> with correct search domains settings. This mode of operation is | |
164 | recommended.</para></listitem> | |
165 | ||
b541146b LP |
166 | <listitem><para>A static file <filename>/usr/lib/systemd/resolv.conf</filename> is provided that lists |
167 | the 127.0.0.53 DNS stub (see above) as only DNS server. This file may be symlinked from | |
168 | <filename>/etc/resolv.conf</filename> in order to connect all local clients that bypass local DNS APIs to | |
e6b2d948 | 169 | <command>systemd-resolved</command>. This file does not contain any search domains.</para></listitem> |
b541146b LP |
170 | |
171 | <listitem><para><command>systemd-resolved</command> maintains the | |
172 | <filename>/run/systemd/resolve/resolv.conf</filename> file for compatibility with traditional Linux | |
173 | programs. This file may be symlinked from <filename>/etc/resolv.conf</filename> and is always kept up-to-date, | |
174 | containing information about all known DNS servers. Note the file format's limitations: it does not know a | |
175 | concept of per-interface DNS servers and hence only contains system-wide DNS server definitions. Note that | |
176 | <filename>/run/systemd/resolve/resolv.conf</filename> should not be used directly by applications, but only | |
177 | through a symlink from <filename>/etc/resolv.conf</filename>. If this mode of operation is used local clients | |
178 | that bypass any local DNS API will also bypass <command>systemd-resolved</command> and will talk directly to the | |
179 | known DNS servers.</para> </listitem> | |
180 | ||
181 | <listitem><para>Alternatively, <filename>/etc/resolv.conf</filename> may be managed by other packages, in which | |
182 | case <command>systemd-resolved</command> will read it for DNS configuration data. In this mode of operation | |
183 | <command>systemd-resolved</command> is consumer rather than provider of this configuration | |
184 | file. </para></listitem> | |
185 | </itemizedlist> | |
186 | ||
187 | <para>Note that the selected mode of operation for this file is detected fully automatically, depending on whether | |
188 | <filename>/etc/resolv.conf</filename> is a symlink to <filename>/run/systemd/resolve/resolv.conf</filename> or | |
189 | lists 127.0.0.53 as DNS server.</para> | |
190 | </refsect1> | |
191 | ||
2c7284a9 LP |
192 | <refsect1> |
193 | <title>Signals</title> | |
194 | ||
195 | <variablelist> | |
196 | <varlistentry> | |
197 | <term><constant>SIGUSR1</constant></term> | |
198 | ||
d55b0463 | 199 | <listitem><para>Upon reception of the <constant>SIGUSR1</constant> process signal |
cf84484a LP |
200 | <command>systemd-resolved</command> will dump the contents of all DNS resource record caches it maintains, as |
201 | well as all feature level information it learnt about configured DNS servers into the system | |
202 | logs.</para></listitem> | |
2c7284a9 LP |
203 | </varlistentry> |
204 | ||
205 | <varlistentry> | |
206 | <term><constant>SIGUSR2</constant></term> | |
207 | ||
d55b0463 LP |
208 | <listitem><para>Upon reception of the <constant>SIGUSR2</constant> process signal |
209 | <command>systemd-resolved</command> will flush all caches it maintains. Note that it should normally not be | |
210 | necessary to request this explicitly – except for debugging purposes – as <command>systemd-resolved</command> | |
211 | flushes the caches automatically anyway any time the host's network configuration changes. Sending this signal | |
b69f810c | 212 | to <command>systemd-resolved</command> is equivalent to the <command>resolvectl --flush-caches</command> |
d55b0463 LP |
213 | command, however the latter is recommended since it operates in a synchronous way.</para></listitem> |
214 | </varlistentry> | |
215 | ||
216 | <varlistentry> | |
217 | <term><constant>SIGRTMIN+1</constant></term> | |
218 | ||
219 | <listitem><para>Upon reception of the <constant>SIGRTMIN+1</constant> process signal | |
220 | <command>systemd-resolved</command> will forget everything it learnt about the configured DNS | |
221 | servers. Specifically any information about server feature support is flushed out, and the server feature | |
222 | probing logic is restarted on the next request, starting with the most fully featured level. Note that it | |
223 | should normally not be necessary to request this explicitly – except for debugging purposes – as | |
224 | <command>systemd-resolved</command> automatically forgets learnt information any time the DNS server | |
225 | configuration changes. Sending this signal to <command>systemd-resolved</command> is equivalent to the | |
b69f810c | 226 | <command>resolvectl --reset-server-features</command> command, however the latter is recommended since it |
d55b0463 | 227 | operates in a synchronous way.</para></listitem> |
2c7284a9 LP |
228 | </varlistentry> |
229 | </variablelist> | |
d55b0463 | 230 | |
2c7284a9 LP |
231 | </refsect1> |
232 | ||
798d3a52 ZJS |
233 | <refsect1> |
234 | <title>See Also</title> | |
235 | <para> | |
236 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
237 | <citerefentry><refentrytitle>resolved.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
b5a8703f | 238 | <citerefentry><refentrytitle>dnssec-trust-anchors.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
437293cf | 239 | <citerefentry><refentrytitle>nss-resolve</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
b69f810c | 240 | <citerefentry><refentrytitle>resolvectl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
1c18f60a | 241 | <citerefentry project='man-pages'><refentrytitle>resolv.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
394bac4f | 242 | <citerefentry project='man-pages'><refentrytitle>hosts</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
798d3a52 ZJS |
243 | <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
244 | <citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
245 | </para> | |
246 | </refsect1> | |
091a364c TG |
247 | |
248 | </refentry> |