2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 This file is part of systemd.
8 Copyright 2016 Lennart Poettering
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.
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.
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/>.
24 <refentry id=
"systemd-resolve"
25 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
28 <title>systemd-resolve
</title>
29 <productname>systemd
</productname>
33 <contrib>Developer
</contrib>
34 <firstname>Lennart
</firstname>
35 <surname>Poettering
</surname>
36 <email>lennart@poettering.net
</email>
42 <refentrytitle>systemd-resolve
</refentrytitle>
43 <manvolnum>1</manvolnum>
47 <refname>systemd-resolve
</refname>
48 <refpurpose>Resolve domain names, IPV4 and IPv6 addresses, DNS resource records, and services
</refpurpose>
53 <command>systemd-resolve
</command>
54 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
55 <arg choice=
"plain" rep=
"repeat"><replaceable>HOSTNAME
</replaceable></arg>
59 <command>systemd-resolve
</command>
60 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
61 <arg choice=
"plain" rep=
"repeat"><replaceable>ADDRESS
</replaceable></arg>
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>
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>
80 <command>systemd-resolve
</command>
81 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
82 <command> --statistics
</command>
86 <command>systemd-resolve
</command>
87 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
88 <command> --reset-statistics
</command>
94 <title>Description
</title>
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>
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>
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
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>
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
126 <title>Options
</title>
129 <term><option>-
4</option></term>
130 <term><option>-
6</option></term>
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>
139 <term><option>-i
</option> <replaceable>INTERFACE
</replaceable></term>
140 <term><option>--interface=
</option><replaceable>INTERFACE
</replaceable></term>
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>
149 <term><option>-p
</option> <replaceable>PROTOCOL
</replaceable></term>
150 <term><option>--protocol=
</option><replaceable>PROTOCOL
</replaceable></term>
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.
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>
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.
180 <term><option>--service
</option></term>
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>
187 <term><option>--service-address=
</option><replaceable>BOOL
</replaceable></term>
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>
194 <term><option>--service-txt=
</option><replaceable>BOOL
</replaceable></term>
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>
201 <term><option>--cname=
</option><replaceable>BOOL
</replaceable></term>
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>
209 <term><option>--search=
</option><replaceable>BOOL
</replaceable></term>
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>
217 <term><option>--legend=
</option><replaceable>BOOL
</replaceable></term>
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>
224 <term><option>--statistics
</option></term>
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>
231 <term><option>--reset-statistics
</option></term>
233 <listitem><para>Resets the statistics counters shown in
<option>--statistics
</option> to zero.
</para></listitem>
236 <xi:include href=
"standard-options.xml" xpointer=
"help" />
237 <xi:include href=
"standard-options.xml" xpointer=
"version" />
242 <title>Examples
</title>
245 <title>Retrieve the addresses of the
<literal>www
.0pointer.net
</literal> domain
</title>
247 <programlisting>$ systemd-resolve www
.0pointer.net
</programlisting>
251 <title>Retrieve the domain of the
<literal>85.214.157.71</literal> IP address
</title>
253 <programlisting>$ systemd-resolve
85.214.157.71</programlisting>
257 <title>Retrieve the MX record of the
<literal>0pointer.net
</literal> domain
</title>
259 <programlisting>$ systemd-resolve -t MX
0pointer.net
</programlisting>
263 <title>Resolve an SRV service
</title>
265 <programlisting>$ systemd-resolve --service _xmpp-server._tcp gmail.com
</programlisting>
271 <title>See Also
</title>
273 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
274 <citerefentry><refentrytitle>systemd-resolved.service
</refentrytitle><manvolnum>8</manvolnum></citerefentry>