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