]> git.proxmox.com Git - systemd.git/blob - man/systemd-resolve.xml
Merge tag 'upstream/229'
[systemd.git] / man / systemd-resolve.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 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.
105 The special value <literal>help</literal> may be used to list known values.</para>
106
107 <para>The <option>--service</option> switch may be used to resolve <ulink
108 url="https://tools.ietf.org/html/rfc2782">SRV</ulink> and <ulink
109 url="https://tools.ietf.org/html/rfc6763">DNS-SD</ulink> services (see below). In this mode, between one and three
110 arguments are required. If three parameters are passed the first is assumed to be the DNS-SD service name, the
111 second the SRV service type, and the third the domain to search in. In this case a full DNS-SD style SRV and TXT
112 lookup is executed. If only two parameters are specified, the first is assumed to be the SRV service type, and the
113 second the domain to look in. In this case no TXT RR is requested. Finally, if only one parameter is specified, it
114 is assumed to be a domain name, that is already prefixed with an SRV type, and an SRV lookup is done (no
115 TXT).</para>
116
117 <para>The <option>--statistics</option> switch may be used to show resolver statistics, including information about
118 the number of succesful and failed DNSSEC validations.</para>
119
120 <para>The <option>--reset-statistics</option> may be used to reset various statistics counters maintained the
121 resolver, including those shown in the <option>--statistics</option> output. This operation requires root
122 privileges.</para>
123 </refsect1>
124
125 <refsect1>
126 <title>Options</title>
127 <variablelist>
128 <varlistentry>
129 <term><option>-4</option></term>
130 <term><option>-6</option></term>
131
132 <listitem><para>By default, when resolving a hostname, both IPv4 and IPv6
133 addresses are acquired. By specifying <option>-4</option> only IPv4 addresses are requested, by specifying
134 <option>-6</option> only IPv6 addresses are requested.</para>
135 </listitem>
136 </varlistentry>
137
138 <varlistentry>
139 <term><option>-i</option> <replaceable>INTERFACE</replaceable></term>
140 <term><option>--interface=</option><replaceable>INTERFACE</replaceable></term>
141
142 <listitem><para>Specifies the network interface to execute the query on. This may either be specified as numeric
143 interface index or as network interface string (e.g. <literal>en0</literal>). Note that this option has no
144 effect if system-wide DNS configuration (as configured in <filename>/etc/resolv.conf</filename> or
145 <filename>/etc/systemd/resolve.conf</filename>) in place of per-link configuration is used.</para></listitem>
146 </varlistentry>
147
148 <varlistentry>
149 <term><option>-p</option> <replaceable>PROTOCOL</replaceable></term>
150 <term><option>--protocol=</option><replaceable>PROTOCOL</replaceable></term>
151
152 <listitem><para>Specifies the network protocol for the query. May be one of <literal>dns</literal>
153 (i.e. classic unicast DNS), <literal>llmnr</literal> (<ulink
154 url="https://tools.ietf.org/html/rfc4795">Link-Local Multicast Name Resolution</ulink>),
155 <literal>llmr-ipv4</literal>, <literal>llmnr-ipv6</literal> (LLMNR via the indicated underlying IP
156 protocols). By default the lookup is done via all protocols suitable for the lookup. If used, limits the set of
157 protocols that may be used. Use this option multiple times to enable resolving via multiple protocols at the
158 same time. The setting <literal>llmnr</literal> is identical to specifying this switch once with
159 <literal>llmnr-ipv4</literal> and once via <literal>llmnr-ipv6</literal>. Note that this option does not force
160 the service to resolve the operation with the specified protocol, as that might require a suitable network
161 interface and configuration.
162 The special value <literal>help</literal> may be used to list known values.
163 </para></listitem>
164 </varlistentry>
165
166 <varlistentry>
167 <term><option>-t</option> <replaceable>TYPE</replaceable></term>
168 <term><option>--type=</option><replaceable>TYPE</replaceable></term>
169 <term><option>-c</option> <replaceable>CLASS</replaceable></term>
170 <term><option>--class=</option><replaceable>CLASS</replaceable></term>
171
172 <listitem><para>Specifies the DNS resource record type (e.g. A, AAAA, MX, …) and class (e.g. IN, ANY, …) to
173 look up. If these options are used a DNS resource record set matching the specified class and type is
174 requested. The class defaults to IN if only a type is specified.
175 The special value <literal>help</literal> may be used to list known values.
176 </para></listitem>
177 </varlistentry>
178
179 <varlistentry>
180 <term><option>--service</option></term>
181
182 <listitem><para>Enables service resolution. This enables DNS-SD and simple SRV service resolution, depending
183 on the specified list of parameters (see above).</para></listitem>
184 </varlistentry>
185
186 <varlistentry>
187 <term><option>--service-address=</option><replaceable>BOOL</replaceable></term>
188
189 <listitem><para>Takes a boolean parameter. If true (the default), when doing a service lookup with
190 <option>--service</option> the hostnames contained in the SRV resource records are resolved as well.</para></listitem>
191 </varlistentry>
192
193 <varlistentry>
194 <term><option>--service-txt=</option><replaceable>BOOL</replaceable></term>
195
196 <listitem><para>Takes a boolean parameter. If true (the default), when doing a DNS-SD service lookup with
197 <option>--service</option> the TXT service metadata record is resolved as well.</para></listitem>
198 </varlistentry>
199
200 <varlistentry>
201 <term><option>--cname=</option><replaceable>BOOL</replaceable></term>
202
203 <listitem><para>Takes a boolean parameter. If true (the default), DNS CNAME or DNAME redirections are
204 followed. Otherwise, if a CNAME or DNAME record is encountered while resolving, an error is
205 returned.</para></listitem>
206 </varlistentry>
207
208 <varlistentry>
209 <term><option>--search=</option><replaceable>BOOL</replaceable></term>
210
211 <listitem><para>Takes a boolean parameter. If true (the default), any specified single-label hostnames will be
212 searched in the domains configured in the search domain list, if it is non-empty. Otherwise, the search domain
213 logic is disabled.</para></listitem>
214 </varlistentry>
215
216 <varlistentry>
217 <term><option>--legend=</option><replaceable>BOOL</replaceable></term>
218
219 <listitem><para>Takes a boolean parameter. If true (the default), column headers and meta information about the
220 query response are shown. Otherwise, this output is suppressed.</para></listitem>
221 </varlistentry>
222
223 <varlistentry>
224 <term><option>--statistics</option></term>
225
226 <listitem><para>If specified general resolver statistics are shown, 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.</para></listitem>
234 </varlistentry>
235
236 <xi:include href="standard-options.xml" xpointer="help" />
237 <xi:include href="standard-options.xml" xpointer="version" />
238 </variablelist>
239 </refsect1>
240
241 <refsect1>
242 <title>Examples</title>
243
244 <example>
245 <title>Retrieve the addresses of the <literal>www.0pointer.net</literal> domain</title>
246
247 <programlisting>$ systemd-resolve www.0pointer.net</programlisting>
248 </example>
249
250 <example>
251 <title>Retrieve the domain of the <literal>85.214.157.71</literal> IP address</title>
252
253 <programlisting>$ systemd-resolve 85.214.157.71</programlisting>
254 </example>
255
256 <example>
257 <title>Retrieve the MX record of the <literal>0pointer.net</literal> domain</title>
258
259 <programlisting>$ systemd-resolve -t MX 0pointer.net</programlisting>
260 </example>
261
262 <example>
263 <title>Resolve an SRV service</title>
264
265 <programlisting>$ systemd-resolve --service _xmpp-server._tcp gmail.com</programlisting>
266 </example>
267
268 </refsect1>
269
270 <refsect1>
271 <title>See Also</title>
272 <para>
273 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
274 <citerefentry><refentrytitle>systemd-resolved.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
275 </para>
276 </refsect1>
277 </refentry>