]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-resolve.xml
man: document systemd-resolve(8)
[thirdparty/systemd.git] / man / systemd-resolve.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<!--
6 This file is part of systemd.
7
8 Copyright 2016 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22-->
23
24<refentry id="systemd-resolve"
25 xmlns:xi="http://www.w3.org/2001/XInclude">
26
27 <refentryinfo>
28 <title>systemd-resolve</title>
29 <productname>systemd</productname>
30
31 <authorgroup>
32 <author>
33 <contrib>Developer</contrib>
34 <firstname>Lennart</firstname>
35 <surname>Poettering</surname>
36 <email>lennart@poettering.net</email>
37 </author>
38 </authorgroup>
39 </refentryinfo>
40
41 <refmeta>
42 <refentrytitle>systemd-resolve</refentrytitle>
43 <manvolnum>1</manvolnum>
44 </refmeta>
45
46 <refnamediv>
47 <refname>systemd-resolve</refname>
48 <refpurpose>Resolve domain names, IPV4 and IPv6 addresses, DNS resource records, and services</refpurpose>
49 </refnamediv>
50
51 <refsynopsisdiv>
52 <cmdsynopsis>
53 <command>systemd-resolve</command>
54 <arg choice="opt" rep="repeat">OPTIONS</arg>
55 <arg choice="plain" rep="repeat"><replaceable>HOSTNAME</replaceable></arg>
56 </cmdsynopsis>
57
58 <cmdsynopsis>
59 <command>systemd-resolve</command>
60 <arg choice="opt" rep="repeat">OPTIONS</arg>
61 <arg choice="plain" rep="repeat"><replaceable>ADDRESS</replaceable></arg>
62 </cmdsynopsis>
63
64 <cmdsynopsis>
65 <command>systemd-resolve</command>
66 <arg choice="opt" rep="repeat">OPTIONS</arg>
67 <command>--type=<replaceable>TYPE</replaceable></command>
68 <arg choice="plain" rep="repeat"><replaceable>RRDOMAIN</replaceable></arg>
69 </cmdsynopsis>
70
71 <cmdsynopsis>
72 <command>systemd-resolve</command>
73 <arg choice="opt" rep="repeat">OPTIONS</arg>
74 <command>--service</command>
75 <arg choice="plain"><arg choice="opt"><arg choice="opt"><replaceable>NAME</replaceable></arg>
76 <replaceable>TYPE</replaceable></arg> <replaceable>DOMAIN</replaceable></arg>
77 </cmdsynopsis>
78
79 <cmdsynopsis>
80 <command>systemd-resolve</command>
81 <arg choice="opt" rep="repeat">OPTIONS</arg>
82 <command>--statistics</command>
83 </cmdsynopsis>
84
85 <cmdsynopsis>
86 <command>systemd-resolve</command>
87 <arg choice="opt" rep="repeat">OPTIONS</arg>
88 <command>--reset-statistics</command>
89 </cmdsynopsis>
90
91 </refsynopsisdiv>
92
93 <refsect1>
94 <title>Description</title>
95
96 <para><command>systemd-resolve</command> may be used to resolve domain names, IPv4 and IPv6 addresses, DNS resource
97 records and services with the
98 <citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
99 resolver service. By default, the specified list of parameters will be resolved as hostnames, retrieving their IPv4
100 and IPv6 addresses. If the parameters specified are formatted as IPv4 or IPv6 operation the reverse operation is
101 done, and a hostname is retrieved for the specified addresses.</para>
102
103 <para>The <option>--type=</option> switch may be used to specify a DNS resource record type (A, AAAA, SOA, MX, ...) in
104 order to request a specific DNS resource record, instead of the address or reverse address lookups.</para>
105
106 <para>The <option>--service</option> switch may be used to resolve <ulink
107 url="https://tools.ietf.org/html/rfc2782">SRV</ulink> and <ulink
108 url="https://tools.ietf.org/html/rfc6763">DNS-SD</ulink> services (see below). In this mode, between one and three
109 arguments are required. If three parameters are passed the first is assumed to be the DNS-SD service name, the
110 second the SRV service type, and the third the domain to search in. In this case a full DNS-SD style SRV and TXT
111 lookup is executed. If only two parameters are specified, the first is assumed to be the SRV service type, and the
112 second the domain to look in. In this case no TXT RR is requested. Finally, if only one parameter is specified, it
113 is assumed to be a domain name, that is already prefixed with an SRV type, and an SRV lookup is done (no
114 TXT).</para>
115
116 <para>The <option>--statistics</option> switch may be used to show resolver statistics, including information about
117 the number of succesful and failed DNSSEC validations.</para>
118
119 <para>The <option>--reset-statistics</option> may be used to reset various statistics counters maintained the
120 resolver, including those shown in the <option>--statistics</option> output. This operation requires root
121 privileges.</para>
122 </refsect1>
123
124 <refsect1>
125 <title>Options</title>
126 <variablelist>
127 <varlistentry>
128 <term><option>-4</option></term>
129 <term><option>-6</option></term>
130
131 <listitem><para>By default, when resolving a hostname, both IPv4 and IPv6
132 addresses are acquired. By specifying <option>-4</option> only IPv4 addresses are requested, by specifying
133 <option>-6</option> only IPv6 addresses are requested.</para>
134 </listitem>
135 </varlistentry>
136
137 <varlistentry>
138 <term><option>-i</option> <replaceable>INTERFACE</replaceable></term>
139 <term><option>--interface=</option><replaceable>INTERFACE</replaceable></term>
140
141 <listitem><para>Specifies the network interface to execute the query on. This may either be specified as numeric
142 interface index or as network interface string (e.g. <literal>en0</literal>). Note that this option has no
143 effect if system-wide DNS configuration (as configured in <filename>/etc/resolv.conf</filename> or
144 <filename>/etc/systemd/resolve.conf</filename>) in place of per-link configuration is used.</para></listitem>
145 </varlistentry>
146
147 <varlistentry>
148 <term><option>-p</option> <replaceable>PROTOCOL</replaceable></term>
149 <term><option>--protocol=</option><replaceable>PROTOCOL</replaceable></term>
150
151 <listitem><para>Specifies the network protocol for the query. May be one of <literal>dns</literal>
152 (i.e. classic unicast DNS), <literal>llmnr</literal> (<ulink
153 url="https://tools.ietf.org/html/rfc4795">Link-Local Multicast Name Resolution</ulink>),
154 <literal>llmr-ipv4</literal>, <literal>llmnr-ipv6</literal> (LLMNR via the indicated underlying IP
155 protocols). By default the lookup is done via all protocols suitable for the lookup. If used, limits the set of
156 protocols that may be used. Use this option multiple times to enable resolving via multiple protocols at the
157 same time. The setting <literal>llmnr</literal> is identical to specifying this switch once with
158 <literal>llmnr-ipv4</literal> and once via <literal>llmnr-ipv6</literal>. Note that this option does not force
159 the service to resolve the operation with the specified protocol, as that might require a suitable network
160 interface and configuration.</para></listitem>
161 </varlistentry>
162
163 <varlistentry>
164 <term><option>-t</option> <replaceable>TYPE</replaceable></term>
165 <term><option>--type=</option><replaceable>TYPE</replaceable></term>
166 <term><option>-c</option> <replaceable>CLASS</replaceable></term>
167 <term><option>--class=</option><replaceable>CLASS</replaceable></term>
168
169 <listitem><para>Specifies the DNS resource record type (e.g. A, AAAA, MX, …) and class (e.g. IN, ANY, …) to
170 look up. If these options are used a DNS resource record set matching the specified class and type is
171 requested. The class defaults to IN if only a type is specified.</para></listitem>
172 </varlistentry>
173
174 <varlistentry>
175 <term><option>--service</option></term>
176
177 <listitem><para>Enables service resolution. This enables DNS-SD and simple SRV service resolution, dependending
178 on the specified list of parameters (see above).</para></listitem>
179 </varlistentry>
180
181 <varlistentry>
182 <term><option>--service-address=</option><replaceable>BOOL</replaceable></term>
183
184 <listitem><para>Takes a boolean parameter. If true (the default), when doing a service lookup with
185 <option>--service</option> the hostnames contained in the SRV resource records are resolved as well.</para></listitem>
186 </varlistentry>
187
188 <varlistentry>
189 <term><option>--service-txt=</option><replaceable>BOOL</replaceable></term>
190
191 <listitem><para>Takes a boolean parameter. If true (the default), when doing a DNS-SD service lookup with
192 <option>--service</option> the TXT service metadata record is resolved as well.</para></listitem>
193 </varlistentry>
194
195 <varlistentry>
196 <term><option>--cname=</option><replaceable>BOOL</replaceable></term>
197
198 <listitem><para>Takes a boolean parameter. If true (the default), DNS CNAME or DNAME redirections are
199 followed. Otherwise, if a CNAME or DNAME record is encountered while resolving, an error is
200 returned.</para></listitem>
201 </varlistentry>
202
203 <varlistentry>
204 <term><option>--search=</option><replaceable>BOOL</replaceable></term>
205
206 <listitem><para>Takes a boolean parameter. If true (the default), any specified single-label hostnames will be
207 searched in the domains configured in the search domain list, if it is non-empty. Otherwise, the search domain
208 logic is disabled.</para></listitem>
209 </varlistentry>
210
211 <varlistentry>
212 <term><option>--legend=</option><replaceable>BOOL</replaceable></term>
213
214 <listitem><para>Takes a boolean parameter. If true (the default), column headers and meta information about the
215 query response are shown. Otherwise, this output is suppressed.</para></listitem>
216 </varlistentry>
217
218 <varlistentry>
219 <term><option>--statistics</option></term>
220
221 <listitem><para>If specified general resolver statistics are shown, including information whether DNSSEC is
222 enabled and available, as well as resolution and validation statistics.</para></listitem>
223 </varlistentry>
224
225 <varlistentry>
226 <term><option>--reset-statistics</option></term>
227
228 <listitem><para>Resets the statistics counters shown in <option>--statistics</option> to zero.</para></listitem>
229 </varlistentry>
230
231 <xi:include href="standard-options.xml" xpointer="help" />
232 <xi:include href="standard-options.xml" xpointer="version" />
233 </variablelist>
234 </refsect1>
235
236 <refsect1>
237 <title>Examples</title>
238
239 <example>
240 <title>Retrieve the addresses of the <literal>www.0pointer.net</literal> domain</title>
241
242 <programlisting>$ systemd-resolve www.0pointer.net</programlisting>
243 </example>
244
245 <example>
246 <title>Retrieve the domain of the <literal>85.214.157.71</literal> IP address</title>
247
248 <programlisting>$ systemd-resolve 85.214.157.71</programlisting>
249 </example>
250
251 <example>
252 <title>Retrieve the MX record of the <literal>0pointer.net</literal> domain</title>
253
254 <programlisting>$ systemd-resolve -t MX 0pointer.net</programlisting>
255 </example>
256
257 <example>
258 <title>Resolve an SRV service</title>
259
260 <programlisting>$ systemd-resolve --service _xmpp-server._tcp gmail.com</programlisting>
261 </example>
262
263 </refsect1>
264
265 <refsect1>
266 <title>See Also</title>
267 <para>
268 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
269 <citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
270 </para>
271 </refsect1>
272</refentry>