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