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