2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % entities SYSTEM "custom-entities.ent" >
7 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
9 <refentry id="resolved.conf" conditional='ENABLE_RESOLVE'
10 xmlns:xi="http://www.w3.org/2001/XInclude">
12 <title>resolved.conf</title>
13 <productname>systemd</productname>
17 <refentrytitle>resolved.conf</refentrytitle>
18 <manvolnum>5</manvolnum>
22 <refname>resolved.conf</refname>
23 <refname>resolved.conf.d</refname>
24 <refpurpose>Network Name Resolution configuration files</refpurpose>
29 <member><filename>/etc/systemd/resolved.conf</filename></member>
30 <member><filename>/run/systemd/resolved.conf</filename></member>
31 <member><filename>/usr/local/lib/systemd/resolved.conf</filename></member>
32 <member><filename>/usr/lib/systemd/resolved.conf</filename></member>
33 <member><filename>/etc/systemd/resolved.conf.d/*.conf</filename></member>
34 <member><filename>/run/systemd/resolved.conf.d/*.conf</filename></member>
35 <member><filename>/usr/local/lib/systemd/resolved.conf.d/*.conf</filename></member>
36 <member><filename>/usr/lib/systemd/resolved.conf.d/*.conf</filename></member>
41 <title>Description</title>
43 <para>These configuration files control local DNS and LLMNR
44 name resolution.</para>
48 <xi:include href="standard-conf.xml" xpointer="main-conf" />
51 <title>Options</title>
53 <para>The following options are available in the [Resolve] section:</para>
55 <variablelist class='network-directives'>
58 <term><varname>DNS=</varname></term>
59 <listitem><para>A space-separated list of IPv4 and IPv6 addresses to use as system DNS servers. Each address can
60 optionally take a port number separated with <literal>:</literal>, a network interface name or index separated with
61 <literal>%</literal>, and a Server Name Indication (SNI) separated with <literal>#</literal>. When IPv6 address is
62 specified with a port number, then the address must be in the square brackets. That is, the acceptable full formats
63 are <literal>111.222.333.444:9953%ifname#example.com</literal> for IPv4 and
64 <literal>[1111:2222::3333]:9953%ifname#example.com</literal> for IPv6. DNS requests are sent to one of the listed
65 DNS servers in parallel to suitable per-link DNS servers acquired from
66 <citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> or
67 set at runtime by external applications. For compatibility reasons, if this setting is not specified, the DNS
68 servers listed in <filename>/etc/resolv.conf</filename> are used instead, if that file exists and any servers
69 are configured in it. This setting defaults to the empty list.</para>
71 <xi:include href="version-info.xml" xpointer="v213"/></listitem>
75 <term><varname>FallbackDNS=</varname></term>
76 <listitem><para>A space-separated list of IPv4 and IPv6 addresses to use as the fallback DNS servers. Please see
77 <varname>DNS=</varname> for acceptable format of addresses. Any per-link DNS servers obtained from
78 <citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
79 take precedence over this setting, as do any servers set via <varname>DNS=</varname> above or
80 <filename>/etc/resolv.conf</filename>. This setting is hence only used if no other DNS server information is
81 known. If this option is not given, a compiled-in list of DNS servers is used instead.</para>
83 <xi:include href="version-info.xml" xpointer="v216"/></listitem>
87 <term><varname>Domains=</varname></term>
88 <listitem><para>A space-separated list of domains, optionally prefixed with <literal>~</literal>,
89 used for two distinct purposes described below. Defaults to the empty list.</para>
91 <para>Any domains <emphasis>not</emphasis> prefixed with <literal>~</literal> are used as search
92 suffixes when resolving single-label hostnames (domain names which contain no dot), in order to
93 qualify them into fully-qualified domain names (FQDNs). These "search domains" are strictly processed
94 in the order they are specified in, until the name with the suffix appended is found. For
95 compatibility reasons, if this setting is not specified, the search domains listed in
96 <filename>/etc/resolv.conf</filename> with the <varname>search</varname> keyword are used instead, if
97 that file exists and any domains are configured in it.</para>
99 <para>The domains prefixed with <literal>~</literal> are called "route-only domains". All domains
100 listed here (<emphasis>both search domains and route-only domains</emphasis> after removing the
101 <literal>~</literal> prefix) define a search path that preferably directs DNS queries to this
102 interface. This search path has an effect only when suitable per-link DNS servers are known. Such
103 servers may be defined through the <varname>DNS=</varname> setting (see above) and dynamically at run
104 time, for example from DHCP leases. If no per-link DNS servers are known, route-only domains have no
107 <para>Use the construct <literal>~.</literal> (which is composed from <literal>~</literal> to
108 indicate a route-only domain and <literal>.</literal> to indicate the DNS root domain that is the
109 implied suffix of all DNS domains) to use the DNS servers defined for this link preferably for all
112 <para>See "Protocols and Routing" in
113 <citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
114 for details of how search and route-only domains are used.</para>
116 <para>Note that configuring the MulticastDNS domain <literal>local</literal> as search or routing
117 domain has the effect of routing lookups for this domain to classic unicast DNS. This may be used to
118 provide compatibility with legacy installations that use this domain in a unicast DNS context,
119 against the IANA assignment of this domain to pure MulticastDNS purposes. Search and routing domains
120 are a unicast DNS concept, they <emphasis>cannot</emphasis> be used to resolve single-label lookups
121 via MulticastDNS.</para>
123 <xi:include href="version-info.xml" xpointer="v229"/>
128 <term><varname>LLMNR=</varname></term>
129 <listitem><para>Takes a boolean argument or
130 <literal>resolve</literal>. Controls Link-Local Multicast Name
131 Resolution support (<ulink
132 url="https://tools.ietf.org/html/rfc4795">RFC 4795</ulink>) on
133 the local host. If true, enables full LLMNR responder and
134 resolver support. If false, disables both. If set to
135 <literal>resolve</literal>, only resolution support is enabled,
136 but responding is disabled. Note that
137 <citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
138 also maintains per-link LLMNR settings. LLMNR will be
139 enabled on a link only if the per-link and the
140 global setting is on.</para>
142 <xi:include href="version-info.xml" xpointer="v216"/></listitem>
146 <term><varname>MulticastDNS=</varname></term>
147 <listitem><para>Takes a boolean argument or
148 <literal>resolve</literal>. Controls Multicast DNS support (<ulink
149 url="https://tools.ietf.org/html/rfc6762">RFC 6762</ulink>) on
150 the local host. If true, enables full Multicast DNS responder and
151 resolver support. If false, disables both. If set to
152 <literal>resolve</literal>, only resolution support is enabled,
153 but responding is disabled. Note that
154 <citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
155 also maintains per-link Multicast DNS settings. Multicast DNS will be
156 enabled on a link only if the per-link and the
157 global setting is on.</para>
159 <xi:include href="version-info.xml" xpointer="v234"/></listitem>
163 <term><varname>DNSSEC=</varname></term>
164 <listitem><para>Takes a boolean argument or <literal>allow-downgrade</literal>.</para>
166 <para>If set to true, all DNS lookups are DNSSEC-validated locally (excluding LLMNR and Multicast
167 DNS). If the response to a lookup request is detected to be invalid a lookup failure is returned to
168 applications. Note that this mode requires a DNS server that supports DNSSEC. If the DNS server does
169 not properly support DNSSEC all validations will fail.</para>
171 <para>If set to <literal>allow-downgrade</literal>, DNSSEC validation is attempted, but if the server
172 does not support DNSSEC properly, DNSSEC mode is automatically disabled. Note that this mode makes
173 DNSSEC validation vulnerable to "downgrade" attacks, where an attacker might be able to trigger a
174 downgrade to non-DNSSEC mode by synthesizing a DNS response that suggests DNSSEC was not
177 <para>If set to false, DNS lookups are not DNSSEC validated.</para>
179 <para>Note that DNSSEC validation requires retrieval of additional DNS data, and thus results in a
180 small DNS lookup time penalty.</para>
182 <para>DNSSEC requires knowledge of "trust anchors" to prove
183 data integrity. The trust anchor for the Internet root domain
184 is built into the resolver, additional trust anchors may be
186 <citerefentry><refentrytitle>dnssec-trust-anchors.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
187 Trust anchors may change at regular intervals, and old trust
188 anchors may be revoked. In such a case DNSSEC validation is
189 not possible until new trust anchors are configured locally or
190 the resolver software package is updated with the new root
191 trust anchor. In effect, when the built-in trust anchor is
192 revoked and <varname>DNSSEC=</varname> is true, all further
193 lookups will fail, as it cannot be proved anymore whether
194 lookups are correctly signed, or validly unsigned. If
195 <varname>DNSSEC=</varname> is set to
196 <literal>allow-downgrade</literal> the resolver will
197 automatically turn off DNSSEC validation in such a case.</para>
199 <para>Client programs looking up DNS data will be informed
200 whether lookups could be verified using DNSSEC, or whether the
201 returned data could not be verified (either because the data
202 was found unsigned in the DNS, or the DNS server did not
203 support DNSSEC or no appropriate trust anchors were known). In
204 the latter case, it is assumed that client programs employ a
205 secondary scheme to validate the returned DNS data, should
206 this be required.</para>
208 <para>It is recommended to set <varname>DNSSEC=</varname> to
209 true on systems where it is known that the DNS server supports
210 DNSSEC correctly, and where software or trust anchor updates
211 happen regularly. On other systems it is recommended to set
212 <varname>DNSSEC=</varname> to
213 <literal>allow-downgrade</literal>.</para>
215 <para>In addition to this global DNSSEC setting
216 <citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
217 also maintains per-link DNSSEC settings. For system DNS
218 servers (see above), only the global DNSSEC setting is in
219 effect. For per-link DNS servers the per-link
220 setting is in effect, unless it is unset in which case the
221 global setting is used instead.</para>
223 <para>Site-private DNS zones generally conflict with DNSSEC
224 operation, unless a negative (if the private zone is not
225 signed) or positive (if the private zone is signed) trust
226 anchor is configured for them. If
227 <literal>allow-downgrade</literal> mode is selected, it is
228 attempted to detect site-private DNS zones using top-level
229 domains (TLDs) that are not known by the DNS root server. This
230 logic does not work in all private zone setups.</para>
232 <para>Defaults to <literal>&DEFAULT_DNSSEC_MODE;</literal>.</para>
234 <xi:include href="version-info.xml" xpointer="v229"/>
239 <term><varname>DNSOverTLS=</varname></term>
241 <para>Takes a boolean argument or <literal>opportunistic</literal>. If
242 true all connections to the server will be encrypted. Note that this
243 mode requires a DNS server that supports DNS-over-TLS and has a valid
244 certificate. If the hostname was specified in <varname>DNS=</varname>
245 by using the format <literal>address#server_name</literal> it
246 is used to validate its certificate and also to enable Server Name
247 Indication (SNI) when opening a TLS connection. Otherwise
248 the certificate is checked against the server's IP.
249 If the DNS server does not support DNS-over-TLS all DNS requests will fail.</para>
251 <para>When set to <literal>opportunistic</literal>
252 DNS request are attempted to send encrypted with DNS-over-TLS.
253 If the DNS server does not support TLS, DNS-over-TLS is disabled.
254 Note that this mode makes DNS-over-TLS vulnerable to "downgrade"
255 attacks, where an attacker might be able to trigger a downgrade
256 to non-encrypted mode by synthesizing a response that suggests
257 DNS-over-TLS was not supported. If set to false, DNS lookups
258 are send over UDP.</para>
260 <para>Note that DNS-over-TLS requires additional data to be
261 send for setting up an encrypted connection, and thus results
262 in a small DNS look-up time penalty.</para>
264 <para>Note that in <literal>opportunistic</literal> mode the
265 resolver is not capable of authenticating the server, so it is
266 vulnerable to "man-in-the-middle" attacks.</para>
268 <para>In addition to this global <varname>DNSOverTLS=</varname> setting
269 <citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
270 also maintains per-link <varname>DNSOverTLS=</varname> settings. For system DNS servers (see above), only the global
271 <varname>DNSOverTLS=</varname> setting is in effect. For per-link DNS servers the per-link setting is in effect, unless
272 it is unset in which case the global setting is used instead.</para>
274 <para>Defaults to <literal>&DEFAULT_DNS_OVER_TLS_MODE;</literal>.</para>
276 <xi:include href="version-info.xml" xpointer="v239"/>
281 <term><varname>Cache=</varname></term>
282 <listitem><para>Takes a boolean or <literal>no-negative</literal> as argument. If
283 <literal>yes</literal> (the default), resolving a domain name which already got queried earlier will
284 return the previous result as long as it is still valid, and thus does not result in a new network
285 request. Be aware that turning off caching comes at a performance penalty, which is particularly high
286 when DNSSEC is used. If <literal>no-negative</literal>, only positive answers are cached.</para>
288 <para>Note that caching is turned off by default for host-local DNS servers.
289 See <varname>CacheFromLocalhost=</varname> for details.</para>
291 <xi:include href="version-info.xml" xpointer="v231"/></listitem>
295 <term><varname>CacheFromLocalhost=</varname></term>
296 <listitem><para>Takes a boolean as argument. If <literal>no</literal> (the default), and response cames from
297 host-local IP address (such as 127.0.0.1 or ::1), the result would not be cached in order to avoid
298 potential duplicate local caching.</para>
300 <xi:include href="version-info.xml" xpointer="v248"/>
305 <term><varname>DNSStubListener=</varname></term>
306 <listitem><para>Takes a boolean argument or one of <literal>udp</literal> and
307 <literal>tcp</literal>. If <literal>udp</literal>, a DNS stub resolver will listen for UDP requests
308 on addresses 127.0.0.53 and 127.0.0.54, port 53. If <literal>tcp</literal>, the stub will listen for
309 TCP requests on the same addresses and port. If <literal>yes</literal> (the default), the stub listens
310 for both UDP and TCP requests. If <literal>no</literal>, the stub listener is disabled.</para>
312 <xi:include href="systemd-resolved.service.xml" xpointer="proxy-stub" />
314 <para>Note that the DNS stub listener is turned off implicitly when its listening address and port are already
317 <xi:include href="version-info.xml" xpointer="v232"/></listitem>
321 <term><varname>DNSStubListenerExtra=</varname></term>
322 <listitem><para>Takes an IPv4 or IPv6 address to listen on. The address may be optionally
323 prefixed with a protocol name (<literal>udp</literal> or <literal>tcp</literal>) separated with
324 <literal>:</literal>. If the protocol is not specified, the service will listen on both UDP and
325 TCP. It may be also optionally suffixed by a numeric port number with separator
326 <literal>:</literal>. When an IPv6 address is specified with a port number, then the address
327 must be in the square brackets. If the port is not specified, then the service uses port 53.
328 Note that this is independent of the primary DNS stub configured with
329 <varname>DNSStubListener=</varname>, and only configures <emphasis>additional</emphasis>
330 sockets to listen on. This option can be specified multiple times. If an empty string is
331 assigned, then the all previous assignments are cleared. Defaults to unset.</para>
334 <programlisting>DNSStubListenerExtra=192.168.10.10
335 DNSStubListenerExtra=2001:db8:0:f102::10
336 DNSStubListenerExtra=192.168.10.11:9953
337 DNSStubListenerExtra=[2001:db8:0:f102::11]:9953
338 DNSStubListenerExtra=tcp:192.168.10.12
339 DNSStubListenerExtra=udp:2001:db8:0:f102::12
340 DNSStubListenerExtra=tcp:192.168.10.13:9953
341 DNSStubListenerExtra=udp:[2001:db8:0:f102::13]:9953</programlisting>
344 <xi:include href="version-info.xml" xpointer="v247"/></listitem>
348 <term><varname>ReadEtcHosts=</varname></term>
349 <listitem><para>Takes a boolean argument. If <literal>yes</literal> (the default),
350 <command>systemd-resolved</command> will read <filename>/etc/hosts</filename>, and try to resolve
351 hosts or address by using the entries in the file before sending query to DNS servers.
354 <xi:include href="version-info.xml" xpointer="v240"/></listitem>
358 <term><varname>ResolveUnicastSingleLabel=</varname></term>
359 <listitem><para>Takes a boolean argument. When false (the default),
360 <command>systemd-resolved</command> will not resolve A and AAAA queries for single-label names over
361 classic DNS. Note that such names may still be resolved if search domains are specified (see
362 <varname>Domains=</varname> above), or using other mechanisms, in particular via LLMNR or from
363 <filename>/etc/hosts</filename>. When true, queries for single-label names will be forwarded to
364 global DNS servers even if no search domains are defined.
367 <para>This option is provided for compatibility with configurations where <emphasis>public DNS
368 servers are not used</emphasis>. Forwarding single-label names to servers not under your control is
369 not standard-conformant, see <ulink
370 url="https://www.iab.org/documents/correspondence-reports-documents/2013-2/iab-statement-dotless-domains-considered-harmful/">IAB
371 Statement</ulink>, and may create a privacy and security risk.</para>
373 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
376 <term><varname>StaleRetentionSec=</varname><replaceable>SECONDS</replaceable></term>
377 <listitem><para>Takes a duration value, which determines the length of time DNS resource records can
378 be retained in the cache beyond their Time To Live (TTL). This allows these records to be returned as
379 stale records. By default, this value is set to zero, meaning that DNS resource records are not
380 stored in the cache after their TTL expires.</para>
382 <para>This is useful when a DNS server failure occurs or becomes unreachable. In such cases,
383 <citerefentry><refentrytitle>systemd-resolved</refentrytitle><manvolnum>8</manvolnum></citerefentry>
384 continues to use the stale records to answer DNS queries, particularly when no valid response can be
385 obtained from the upstream DNS servers. However, this does not apply to NXDOMAIN responses, as those
386 are still perfectly valid responses. This feature enhances resilience against DNS infrastructure
387 failures and outages.</para>
389 <para><command>systemd-resolved</command> always attempts to reach the upstream DNS servers first,
390 before providing the client application with any stale data. If this feature is enabled, cache will
391 not be flushed when changing servers.</para>
393 <xi:include href="version-info.xml" xpointer="v254"/>
400 <title>See Also</title>
401 <para><simplelist type="inline">
402 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
403 <member><citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
404 <member><citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member>
405 <member><citerefentry><refentrytitle>dnssec-trust-anchors.d</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
406 <member><citerefentry project='man-pages'><refentrytitle>resolv.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>