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