]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/resolvectl.xml
8c1d6e5de4a2924070d6e161d40f8e47bdb735fb
[thirdparty/systemd.git] / man / resolvectl.xml
1 <?xml version='1.0'?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1+ -->
5
6 <refentry id="resolvectl" conditional='ENABLE_RESOLVE'
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>resolvectl</title>
11 <productname>systemd</productname>
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>resolvectl</refentrytitle>
16 <manvolnum>1</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>resolvectl</refname>
21 <refname>resolvconf</refname>
22 <refpurpose>Resolve domain names, IPV4 and IPv6 addresses, DNS resource records, and services; introspect and reconfigure the DNS resolver</refpurpose>
23 </refnamediv>
24
25 <refsynopsisdiv>
26 <cmdsynopsis>
27 <command>resolvectl</command>
28 <arg choice="opt" rep="repeat">OPTIONS</arg>
29 <arg choice="req">COMMAND</arg>
30 <arg choice="opt" rep="repeat">NAME</arg>
31 </cmdsynopsis>
32 </refsynopsisdiv>
33
34 <refsect1>
35 <title>Description</title>
36
37 <para><command>resolvectl</command> may be used to resolve domain names, IPv4 and IPv6 addresses, DNS resource
38 records and services with the
39 <citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
40 resolver service. By default, the specified list of parameters will be resolved as hostnames, retrieving their IPv4
41 and IPv6 addresses. If the parameters specified are formatted as IPv4 or IPv6 operation the reverse operation is
42 done, and a hostname is retrieved for the specified addresses.</para>
43
44 <para>The program's output contains information about the protocol used for the look-up and on which network
45 interface the data was discovered. It also contains information on whether the information could be
46 authenticated. All data for which local DNSSEC validation succeeds is considered authenticated. Moreover all data
47 originating from local, trusted sources is also reported authenticated, including resolution of the local host
48 name, the <literal>localhost</literal> host name or all data from <filename>/etc/hosts</filename>.</para>
49 </refsect1>
50
51 <refsect1>
52 <title>Commands</title>
53 <variablelist>
54
55 <varlistentry>
56 <term><option>query <replaceable>HOSTNAME|ADDRESS</replaceable></option></term>
57
58 <listitem><para>Resolve domain names, IPv4 and IPv6 addresses.</para></listitem>
59 </varlistentry>
60
61 <varlistentry>
62 <term><option>service [[<replaceable>NAME</replaceable>] <replaceable>TYPE</replaceable>] <replaceable>DOMAIN</replaceable></option></term>
63
64 <listitem><para>Resolve <ulink url="https://tools.ietf.org/html/rfc6763">DNS-SD</ulink> and
65 <ulink url="https://tools.ietf.org/html/rfc2782">SRV</ulink> services, depending on the specified list of parameters.
66 If three parameters are passed the first is assumed to be the DNS-SD service name, the second the SRV service type,
67 and the third the domain to search in. In this case a full DNS-SD style SRV and TXT lookup is executed. If only two
68 parameters are specified, the first is assumed to be the SRV service type, and the second the domain to look in. In
69 this case no TXT RR is requested. Finally, if only one parameter is specified, it is assumed to be a domain name,
70 that is already prefixed with an SRV type, and an SRV lookup is done (no TXT).</para></listitem>
71 </varlistentry>
72
73 <varlistentry>
74 <term><option>openpgp <replaceable>EMAIL@DOMAIN</replaceable></option></term>
75
76 <listitem><para>Query PGP keys stored as <ulink url="https://tools.ietf.org/html/rfc7929">OPENPGPKEY</ulink>
77 resource records. Specified e-mail addresses are converted to the corresponding DNS domain name, and any
78 OPENPGPKEY keys are printed.</para></listitem>
79 </varlistentry>
80
81 <varlistentry>
82 <term><option>tlsa [<replaceable>FAMILY</replaceable>] <replaceable>DOMAIN</replaceable>[:<replaceable>PORT</replaceable>]…</option></term>
83
84 <listitem><para>Query TLS public keys stored as <ulink url="https://tools.ietf.org/html/rfc6698">TLSA</ulink>
85 resource records. A query will be performed for each of the specified names prefixed with the port and family
86 (<literal>_<replaceable>port</replaceable>._<replaceable>family</replaceable>.<replaceable>domain</replaceable></literal>).
87 The port number may be specified after a colon (<literal>:</literal>), otherwise <constant>443</constant> will be used
88 by default. The family may be specified as the first argument, otherwise <constant>tcp</constant> will be used.</para></listitem>
89 </varlistentry>
90
91 <varlistentry>
92 <term><option>status [<replaceable>LINK</replaceable>…]</option></term>
93
94 <listitem><para>Shows the global and per-link DNS settings currently in effect. If no command is specified,
95 this is the implied default.</para></listitem>
96 </varlistentry>
97
98 <varlistentry>
99 <term><option>statistics</option></term>
100
101 <listitem><para>Shows general resolver statistics, including information whether DNSSEC is
102 enabled and available, as well as resolution and validation statistics.</para></listitem>
103 </varlistentry>
104
105 <varlistentry>
106 <term><option>reset-statistics</option></term>
107
108 <listitem><para>Resets the statistics counters shown in <option>statistics</option> to zero.
109 This operation requires root privileges.</para></listitem>
110 </varlistentry>
111
112 <varlistentry>
113 <term><option>flush-caches</option></term>
114
115 <listitem><para>Flushes all DNS resource record caches the service maintains locally. This is mostly equivalent
116 to sending the <constant>SIGUSR2</constant> to the <command>systemd-resolved</command>
117 service.</para></listitem>
118 </varlistentry>
119
120 <varlistentry>
121 <term><option>reset-server-features</option></term>
122
123 <listitem><para>Flushes all feature level information the resolver learnt about specific servers, and ensures
124 that the server feature probing logic is started from the beginning with the next look-up request. This is
125 mostly equivalent to sending the <constant>SIGRTMIN+1</constant> to the <command>systemd-resolved</command>
126 service.</para></listitem>
127 </varlistentry>
128
129 <varlistentry>
130 <term><option>dns [<replaceable>LINK</replaceable> [<replaceable>SERVER</replaceable>…]]</option></term>
131 <term><option>domain [<replaceable>LINK</replaceable> [<replaceable>DOMAIN</replaceable>…]]</option></term>
132 <term><option>default-route [<replaceable>LINK</replaceable> [<replaceable>BOOL</replaceable>…]]</option></term>
133 <term><option>llmnr [<replaceable>LINK</replaceable> [<replaceable>MODE</replaceable>]]</option></term>
134 <term><option>mdns [<replaceable>LINK</replaceable> [<replaceable>MODE</replaceable>]]</option></term>
135 <term><option>dnssec [<replaceable>LINK</replaceable> [<replaceable>MODE</replaceable>]]</option></term>
136 <term><option>dnsovertls [<replaceable>LINK</replaceable> [<replaceable>MODE</replaceable>]]</option></term>
137 <term><option>nta [<replaceable>LINK</replaceable> [<replaceable>DOMAIN</replaceable>…]]</option></term>
138
139 <listitem>
140 <para>Get/set per-interface DNS configuration. These commands may be used to configure various DNS settings
141 for network interfaces. These commands may be used to inform <command>systemd-resolved</command> or
142 <command>systemd-networkd</command> about per-interface DNS configuration determined
143 through external means. The <option>dns</option> command expects IPv4 or IPv6 address specifications of DNS
144 servers to use. The <option>domain</option> command expects valid DNS domains, possibly prefixed with
145 <literal>~</literal>, and configures a per-interface search or route-only domain. The
146 <option>default-route</option> command expects a boolean parameter, and configures whether the link may be
147 used as default route for DNS lookups, i.e. if it is suitable for lookups on domains no other link explicitly
148 is configured for. The <option>llmnr</option>, <option>mdns</option>, <option>dnssec</option> and
149 <option>dnsovertls</option> commands may be used to configure the per-interface LLMNR, MulticastDNS, DNSSEC
150 and DNSOverTLS settings. Finally, <option>nta</option> command may be used to configure additional
151 per-interface DNSSEC NTA domains.</para>
152
153 <para>Options <option>dns</option>, <option>domain</option> and <option>nta</option> can take
154 a single empty string argument to clear their respective value lists.</para>
155
156 <para>For details about these settings, their possible values and their effect, see the corresponding options in
157 <citerefentry><refentrytitle>systemd.network</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
158 </listitem>
159 </varlistentry>
160
161 <varlistentry>
162 <term><option>revert <replaceable>LINK</replaceable></option></term>
163
164 <listitem><para>Revert the per-interface DNS configuration. If the DNS configuration is reverted all
165 per-interface DNS setting are reset to their defaults, undoing all effects of <option>dns</option>,
166 <option>domain</option>, <option>default-route</option>, <option>llmnr</option>, <option>mdns</option>,
167 <option>dnssec</option>, <option>dnsovertls</option>, <option>nta</option>. Note that when a network interface
168 disappears all configuration is lost automatically, an explicit reverting is not necessary in that
169 case.</para></listitem>
170 </varlistentry>
171
172 </variablelist>
173 </refsect1>
174
175 <refsect1>
176 <title>Options</title>
177 <variablelist>
178 <varlistentry>
179 <term><option>-4</option></term>
180 <term><option>-6</option></term>
181
182 <listitem><para>By default, when resolving a hostname, both IPv4 and IPv6
183 addresses are acquired. By specifying <option>-4</option> only IPv4 addresses are requested, by specifying
184 <option>-6</option> only IPv6 addresses are requested.</para>
185 </listitem>
186 </varlistentry>
187
188 <varlistentry>
189 <term><option>-i</option> <replaceable>INTERFACE</replaceable></term>
190 <term><option>--interface=</option><replaceable>INTERFACE</replaceable></term>
191
192 <listitem><para>Specifies the network interface to execute the query on. This may either be specified as numeric
193 interface index or as network interface string (e.g. <literal>en0</literal>). Note that this option has no
194 effect if system-wide DNS configuration (as configured in <filename>/etc/resolv.conf</filename> or
195 <filename>/etc/systemd/resolve.conf</filename>) in place of per-link configuration is used.</para></listitem>
196 </varlistentry>
197
198 <varlistentry>
199 <term><option>-p</option> <replaceable>PROTOCOL</replaceable></term>
200 <term><option>--protocol=</option><replaceable>PROTOCOL</replaceable></term>
201
202 <listitem><para>Specifies the network protocol for the query. May be one of <literal>dns</literal>
203 (i.e. classic unicast DNS), <literal>llmnr</literal> (<ulink
204 url="https://tools.ietf.org/html/rfc4795">Link-Local Multicast Name Resolution</ulink>),
205 <literal>llmnr-ipv4</literal>, <literal>llmnr-ipv6</literal> (LLMNR via the indicated underlying IP
206 protocols), <literal>mdns</literal> (<ulink url="https://www.ietf.org/rfc/rfc6762.txt">Multicast DNS</ulink>),
207 <literal>mdns-ipv4</literal>, <literal>mdns-ipv6</literal> (MDNS via the indicated underlying IP protocols).
208 By default the lookup is done via all protocols suitable for the lookup. If used, limits the set of
209 protocols that may be used. Use this option multiple times to enable resolving via multiple protocols at the
210 same time. The setting <literal>llmnr</literal> is identical to specifying this switch once with
211 <literal>llmnr-ipv4</literal> and once via <literal>llmnr-ipv6</literal>. Note that this option does not force
212 the service to resolve the operation with the specified protocol, as that might require a suitable network
213 interface and configuration.
214 The special value <literal>help</literal> may be used to list known values.
215 </para></listitem>
216 </varlistentry>
217
218 <varlistentry>
219 <term><option>-t</option> <replaceable>TYPE</replaceable></term>
220 <term><option>--type=</option><replaceable>TYPE</replaceable></term>
221 <term><option>-c</option> <replaceable>CLASS</replaceable></term>
222 <term><option>--class=</option><replaceable>CLASS</replaceable></term>
223
224 <listitem><para>Specifies the DNS resource record type (e.g. A, AAAA, MX, …) and class (e.g. IN, ANY, …) to
225 look up. If these options are used a DNS resource record set matching the specified class and type is
226 requested. The class defaults to IN if only a type is specified.
227 The special value <literal>help</literal> may be used to list known values.
228 </para></listitem>
229 </varlistentry>
230
231 <varlistentry>
232 <term><option>--service-address=</option><replaceable>BOOL</replaceable></term>
233
234 <listitem><para>Takes a boolean parameter. If true (the default), when doing a service lookup with
235 <option>--service</option> the hostnames contained in the SRV resource records are resolved as well.</para></listitem>
236 </varlistentry>
237
238 <varlistentry>
239 <term><option>--service-txt=</option><replaceable>BOOL</replaceable></term>
240
241 <listitem><para>Takes a boolean parameter. If true (the default), when doing a DNS-SD service lookup with
242 <option>--service</option> the TXT service metadata record is resolved as well.</para></listitem>
243 </varlistentry>
244
245 <varlistentry>
246 <term><option>--cname=</option><replaceable>BOOL</replaceable></term>
247
248 <listitem><para>Takes a boolean parameter. If true (the default), DNS CNAME or DNAME redirections are
249 followed. Otherwise, if a CNAME or DNAME record is encountered while resolving, an error is
250 returned.</para></listitem>
251 </varlistentry>
252
253 <varlistentry>
254 <term><option>--search=</option><replaceable>BOOL</replaceable></term>
255
256 <listitem><para>Takes a boolean parameter. If true (the default), any specified single-label hostnames will be
257 searched in the domains configured in the search domain list, if it is non-empty. Otherwise, the search domain
258 logic is disabled.</para></listitem>
259 </varlistentry>
260
261 <varlistentry>
262 <term><option>--raw</option><optional>=payload|packet</optional></term>
263
264 <listitem><para>Dump the answer as binary data. If there is no argument or if the argument is
265 <literal>payload</literal>, the payload of the packet is exported. If the argument is
266 <literal>packet</literal>, the whole packet is dumped in wire format, prefixed by
267 length specified as a little-endian 64-bit number. This format allows multiple packets
268 to be dumped and unambiguously parsed.</para></listitem>
269 </varlistentry>
270
271 <varlistentry>
272 <term><option>--legend=</option><replaceable>BOOL</replaceable></term>
273
274 <listitem><para>Takes a boolean parameter. If true (the default), column headers and meta information about the
275 query response are shown. Otherwise, this output is suppressed.</para></listitem>
276 </varlistentry>
277
278 <xi:include href="standard-options.xml" xpointer="help" />
279 <xi:include href="standard-options.xml" xpointer="version" />
280 <xi:include href="standard-options.xml" xpointer="no-pager" />
281 </variablelist>
282 </refsect1>
283
284 <refsect1>
285 <title>Compatibility with <citerefentry><refentrytitle>resolvconf</refentrytitle><manvolnum>8</manvolnum></citerefentry></title>
286
287 <para><command>resolvectl</command> is a multi-call binary. When invoked as <literal>resolvconf</literal>
288 (generally achieved by means of a symbolic link of this name to the <command>resolvectl</command> binary) it
289 is run in a limited <citerefentry><refentrytitle>resolvconf</refentrytitle><manvolnum>8</manvolnum></citerefentry>
290 compatibility mode. It accepts mostly the same arguments and pushes all data into
291 <citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
292 similar to how <option>dns</option> and <option>domain</option> commands operate. Note that
293 <command>systemd-resolved.service</command> is the only supported backend, which is different from other
294 implementations of this command. Note that not all operations supported by other implementations are supported
295 natively. Specifically:</para>
296
297 <variablelist>
298 <varlistentry>
299 <term><option>-a</option></term>
300 <listitem><para>Registers per-interface DNS configuration data with
301 <command>systemd-resolved</command>. Expects a network interface name as only command line argument. Reads
302 <citerefentry><refentrytitle>resolv.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry> compatible DNS
303 configuration data from its standard input. Relevant fields are <literal>nameserver</literal> and
304 <literal>domain</literal>/<literal>search</literal>. This command is mostly identical to invoking
305 <command>resolvectl</command> with a combination of <option>dns</option> and
306 <option>domain</option> commands.</para></listitem>
307 </varlistentry>
308
309 <varlistentry>
310 <term><option>-d</option></term>
311 <listitem><para>Unregisters per-interface DNS configuration data with <command>systemd-resolved</command>. This
312 command is mostly identical to invoking <command>resolvectl revert</command>.</para></listitem>
313 </varlistentry>
314
315 <varlistentry>
316 <term><option>-f</option></term>
317
318 <listitem><para>When specified <option>-a</option> and <option>-d</option> will not complain about missing
319 network interfaces and will silently execute no operation in that case.</para></listitem>
320 </varlistentry>
321
322 <varlistentry>
323 <term><option>-x</option></term>
324
325 <listitem><para>This switch for "exclusive" operation is supported only partially. It is mapped to an
326 additional configured search domain of <literal>~.</literal> — i.e. ensures that DNS traffic is preferably
327 routed to the DNS servers on this interface, unless there are other, more specific domains configured on other
328 interfaces.</para></listitem>
329 </varlistentry>
330
331 <varlistentry>
332 <term><option>-m</option></term>
333 <term><option>-p</option></term>
334
335 <listitem><para>These switches are not supported and are silently ignored.</para></listitem>
336 </varlistentry>
337
338 <varlistentry>
339 <term><option>-u</option></term>
340 <term><option>-I</option></term>
341 <term><option>-i</option></term>
342 <term><option>-l</option></term>
343 <term><option>-R</option></term>
344 <term><option>-r</option></term>
345 <term><option>-v</option></term>
346 <term><option>-V</option></term>
347 <term><option>--enable-updates</option></term>
348 <term><option>--disable-updates</option></term>
349 <term><option>--are-updates-enabled</option></term>
350
351 <listitem><para>These switches are not supported and the command will fail if used.</para></listitem>
352 </varlistentry>
353
354 </variablelist>
355
356 <para>See <citerefentry><refentrytitle>resolvconf</refentrytitle><manvolnum>8</manvolnum></citerefentry> for details on this command line options.</para>
357 </refsect1>
358
359 <refsect1>
360 <title>Examples</title>
361
362 <example>
363 <title>Retrieve the addresses of the <literal>www.0pointer.net</literal> domain</title>
364
365 <programlisting>$ resolvectl query www.0pointer.net
366 www.0pointer.net: 2a01:238:43ed:c300:10c3:bcf3:3266:da74
367 85.214.157.71
368
369 -- Information acquired via protocol DNS in 611.6ms.
370 -- Data is authenticated: no
371 </programlisting>
372 </example>
373
374 <example>
375 <title>Retrieve the domain of the <literal>85.214.157.71</literal> IP address</title>
376
377 <programlisting>$ resolvectl query 85.214.157.71
378 85.214.157.71: gardel.0pointer.net
379
380 -- Information acquired via protocol DNS in 1.2997s.
381 -- Data is authenticated: no
382 </programlisting>
383 </example>
384
385 <example>
386 <title>Retrieve the MX record of the <literal>yahoo.com</literal> domain</title>
387
388 <programlisting>$ resolvectl --legend=no -t MX query yahoo.com
389 yahoo.com. IN MX 1 mta7.am0.yahoodns.net
390 yahoo.com. IN MX 1 mta6.am0.yahoodns.net
391 yahoo.com. IN MX 1 mta5.am0.yahoodns.net
392 </programlisting>
393 </example>
394
395 <example>
396 <title>Resolve an SRV service</title>
397
398 <programlisting>$ resolvectl service _xmpp-server._tcp gmail.com
399 _xmpp-server._tcp/gmail.com: alt1.xmpp-server.l.google.com:5269 [priority=20, weight=0]
400 173.194.210.125
401 alt4.xmpp-server.l.google.com:5269 [priority=20, weight=0]
402 173.194.65.125
403
404 </programlisting>
405 </example>
406
407 <example>
408 <title>Retrieve a PGP key</title>
409
410 <programlisting>$ resolvectl openpgp zbyszek@fedoraproject.org
411 d08ee310438ca124a6149ea5cc21b6313b390dce485576eff96f8722._openpgpkey.fedoraproject.org. IN OPENPGPKEY
412 mQINBFBHPMsBEACeInGYJCb+7TurKfb6wGyTottCDtiSJB310i37/6ZYoeIay/5soJjlMyf
413 MFQ9T2XNT/0LM6gTa0MpC1st9LnzYTMsT6tzRly1D1UbVI6xw0g0vE5y2Cjk3xUwAynCsSs
414
415 </programlisting>
416 </example>
417
418 <example>
419 <title>Retrieve a TLS key (<literal>tcp</literal> and
420 <literal>:443</literal> could be skipped)</title>
421
422 <programlisting>$ resolvectl tlsa tcp fedoraproject.org:443
423 _443._tcp.fedoraproject.org IN TLSA 0 0 1 19400be5b7a31fb733917700789d2f0a2471c0c9d506c0e504c06c16d7cb17c0
424 -- Cert. usage: CA constraint
425 -- Selector: Full Certificate
426 -- Matching type: SHA-256
427 </programlisting>
428 </example>
429 </refsect1>
430
431 <refsect1>
432 <title>See Also</title>
433 <para>
434 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
435 <citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
436 <citerefentry><refentrytitle>systemd.dnssd</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
437 <citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
438 <citerefentry><refentrytitle>resolvconf</refentrytitle><manvolnum>8</manvolnum></citerefentry>
439 </para>
440 </refsect1>
441 </refentry>