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