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