1RESOLVECTL(1) resolvectl RESOLVECTL(1)
2
3
4
6 resolvectl, resolvconf - Resolve domain names, IPV4 and IPv6 addresses,
7 DNS resource records, and services; introspect and reconfigure the DNS
8 resolver
9
11 resolvectl [OPTIONS...] {COMMAND} [NAME...]
12
14 resolvectl may be used to resolve domain names, IPv4 and IPv6
15 addresses, DNS resource records and services with the systemd-
16 resolved.service(8) resolver service. By default, the specified list of
17 parameters will be resolved as hostnames, retrieving their IPv4 and
18 IPv6 addresses. If the parameters specified are formatted as IPv4 or
19 IPv6 addresses the reverse operation is done, and a hostname is
20 retrieved for the specified addresses.
21
22 The program's output contains information about the protocol used for
23 the look-up and on which network interface the data was discovered. It
24 also contains information on whether the information could be
25 authenticated. All data for which local DNSSEC validation succeeds is
26 considered authenticated. Moreover all data originating from local,
27 trusted sources is also reported authenticated, including resolution of
28 the local host name, the "localhost" hostname or all data from
29 /etc/hosts.
30
32 query HOSTNAME|ADDRESS...
33 Resolve domain names, as well as IPv4 and IPv6 addresses. When used
34 in conjunction with --type= or --class= (see below), resolves
35 low-level DNS resource records.
36
37 If a single-label domain name is specified it is searched for
38 according to the configured search domains — unless --search=no or
39 --type=/--class= are specified, both of which turn this logic off.
40
41 If an international domain name is specified, it is automatically
42 translated according to IDNA rules when resolved via classic DNS —
43 but not for look-ups via MulticastDNS or LLMNR. If --type=/--class=
44 is used IDNA translation is turned off and domain names are
45 processed as specified.
46
47 service [[NAME] TYPE] DOMAIN
48 Resolve DNS-SD[1] and SRV[2] services, depending on the specified
49 list of parameters. If three parameters are passed the first is
50 assumed to be the DNS-SD service name, the second the SRV service
51 type, and the third the domain to search in. In this case a full
52 DNS-SD style SRV and TXT lookup is executed. If only two parameters
53 are specified, the first is assumed to be the SRV service type, and
54 the second the domain to look in. In this case no TXT resource
55 record is requested. Finally, if only one parameter is specified,
56 it is assumed to be a domain name, that is already prefixed with an
57 SRV type, and an SRV lookup is done (no TXT).
58
59 openpgp EMAIL@DOMAIN...
60 Query PGP keys stored as OPENPGPKEY resource records, see RFC
61 7929[3]. Specified e-mail addresses are converted to the
62 corresponding DNS domain name, and any OPENPGPKEY keys are printed.
63
64 tlsa [FAMILY] DOMAIN[:PORT]...
65 Query TLS public keys stored as TLSA resource records, see RFC
66 6698[4]. A query will be performed for each of the specified names
67 prefixed with the port and family ("_port._family.domain"). The
68 port number may be specified after a colon (":"), otherwise 443
69 will be used by default. The family may be specified as the first
70 argument, otherwise tcp will be used.
71
72 status [LINK...]
73 Shows the global and per-link DNS settings currently in effect. If
74 no command is specified, this is the implied default.
75
76 statistics
77 Shows general resolver statistics, including information whether
78 DNSSEC is enabled and available, as well as resolution and
79 validation statistics.
80
81 reset-statistics
82 Resets the statistics counters shown in statistics to zero. This
83 operation requires root privileges.
84
85 flush-caches
86 Flushes all DNS resource record caches the service maintains
87 locally. This is mostly equivalent to sending the SIGUSR2 to the
88 systemd-resolved service.
89
90 reset-server-features
91 Flushes all feature level information the resolver learnt about
92 specific servers, and ensures that the server feature probing logic
93 is started from the beginning with the next look-up request. This
94 is mostly equivalent to sending the SIGRTMIN+1 to the
95 systemd-resolved service.
96
97 dns [LINK [SERVER...]], domain [LINK [DOMAIN...]], default-route [LINK
98 [BOOL...]], llmnr [LINK [MODE]], mdns [LINK [MODE]], dnssec [LINK
99 [MODE]], dnsovertls [LINK [MODE]], nta [LINK [DOMAIN...]]
100 Get/set per-interface DNS configuration. These commands may be used
101 to configure various DNS settings for network interfaces. These
102 commands may be used to inform systemd-resolved or systemd-networkd
103 about per-interface DNS configuration determined through external
104 means. The dns command expects IPv4 or IPv6 address specifications
105 of DNS servers to use. Each address can optionally take a port
106 number separated with ":", a network interface name or index
107 separated with "%", and a Server Name Indication (SNI) separated
108 with "#". When IPv6 address is specified with a port number, then
109 the address must be in the square brackets. That is, the acceptable
110 full formats are "111.222.333.444:9953%ifname#example.com" for IPv4
111 and "[1111:2222::3333]:9953%ifname#example.com" for IPv6. The
112 domain command expects valid DNS domains, possibly prefixed with
113 "~", and configures a per-interface search or route-only domain.
114 The default-route command expects a boolean parameter, and
115 configures whether the link may be used as default route for DNS
116 lookups, i.e. if it is suitable for lookups on domains no other
117 link explicitly is configured for. The llmnr, mdns, dnssec and
118 dnsovertls commands may be used to configure the per-interface
119 LLMNR, MulticastDNS, DNSSEC and DNSOverTLS settings. Finally, nta
120 command may be used to configure additional per-interface DNSSEC
121 NTA domains.
122
123 Commands dns, domain and nta can take a single empty string
124 argument to clear their respective value lists.
125
126 For details about these settings, their possible values and their
127 effect, see the corresponding settings in systemd.network(5).
128
129 revert LINK
130 Revert the per-interface DNS configuration. If the DNS
131 configuration is reverted all per-interface DNS setting are reset
132 to their defaults, undoing all effects of dns, domain,
133 default-route, llmnr, mdns, dnssec, dnsovertls, nta. Note that when
134 a network interface disappears all configuration is lost
135 automatically, an explicit reverting is not necessary in that case.
136
137 monitor
138 Show a continuous stream of local client resolution queries and
139 their responses. Whenever a local query is completed the query's
140 DNS resource lookup key and resource records are shown. Note that
141 this displays queries issued locally only, and does not immediately
142 relate to DNS requests submitted to configured DNS servers or the
143 LLMNR or MulticastDNS zones, as lookups may be answered from the
144 local cache, or might result in multiple DNS transactions (for
145 example to validate DNSSEC information). If CNAME/CNAME redirection
146 chains are followed, a separate query will be displayed for each
147 element of the chain. Use --json= to enable JSON output.
148
149 log-level [LEVEL]
150 If no argument is given, print the current log level of the
151 manager. If an optional argument LEVEL is provided, then the
152 command changes the current log level of the manager to LEVEL
153 (accepts the same values as --log-level= described in systemd(1)).
154
156 -4, -6
157 By default, when resolving a hostname, both IPv4 and IPv6 addresses
158 are acquired. By specifying -4 only IPv4 addresses are requested,
159 by specifying -6 only IPv6 addresses are requested.
160
161 -i INTERFACE, --interface=INTERFACE
162 Specifies the network interface to execute the query on. This may
163 either be specified as numeric interface index or as network
164 interface string (e.g. "en0"). Note that this option has no effect
165 if system-wide DNS configuration (as configured in /etc/resolv.conf
166 or /etc/systemd/resolved.conf) in place of per-link configuration
167 is used.
168
169 -p PROTOCOL, --protocol=PROTOCOL
170 Specifies the network protocol for the query. May be one of "dns"
171 (i.e. classic unicast DNS), "llmnr" (Link-Local Multicast Name
172 Resolution[5]), "llmnr-ipv4", "llmnr-ipv6" (LLMNR via the indicated
173 underlying IP protocols), "mdns" (Multicast DNS[6]), "mdns-ipv4",
174 "mdns-ipv6" (MDNS via the indicated underlying IP protocols). By
175 default the lookup is done via all protocols suitable for the
176 lookup. If used, limits the set of protocols that may be used. Use
177 this option multiple times to enable resolving via multiple
178 protocols at the same time. The setting "llmnr" is identical to
179 specifying this switch once with "llmnr-ipv4" and once via
180 "llmnr-ipv6". Note that this option does not force the service to
181 resolve the operation with the specified protocol, as that might
182 require a suitable network interface and configuration. The special
183 value "help" may be used to list known values.
184
185 -t TYPE, --type=TYPE, -c CLASS, --class=CLASS
186 When used in conjunction with the query command, specifies the DNS
187 resource record type (e.g. A, AAAA, MX, ...) and class (e.g. IN,
188 ANY, ...) to look up. If these options are used a DNS resource
189 record set matching the specified class and type is requested. The
190 class defaults to IN if only a type is specified. The special value
191 "help" may be used to list known values.
192
193 Without these options resolvectl query provides high-level domain
194 name to address and address to domain name resolution. With these
195 options it provides low-level DNS resource record resolution. The
196 search domain logic is automatically turned off when these options
197 are used, i.e. specified domain names need to be fully qualified
198 domain names. Moreover, IDNA internal domain name translation is
199 turned off as well, i.e. international domain names should be
200 specified in "xn--..." notation, unless look-up in
201 MulticastDNS/LLMNR is desired, in which case UTF-8 characters
202 should be used.
203
204 --service-address=BOOL
205 Takes a boolean parameter. If true (the default), when doing a
206 service lookup with --service the hostnames contained in the SRV
207 resource records are resolved as well.
208
209 --service-txt=BOOL
210 Takes a boolean parameter. If true (the default), when doing a
211 DNS-SD service lookup with --service the TXT service metadata
212 record is resolved as well.
213
214 --cname=BOOL
215 Takes a boolean parameter. If true (the default), DNS CNAME or
216 DNAME redirections are followed. Otherwise, if a CNAME or DNAME
217 record is encountered while resolving, an error is returned.
218
219 --validate=BOOL
220 Takes a boolean parameter; used in conjunction with query. If true
221 (the default), DNSSEC validation is applied as usual — under the
222 condition that it is enabled for the network and for
223 systemd-resolved.service as a whole. If false, DNSSEC validation is
224 disabled for the specific query, regardless of whether it is
225 enabled for the network or in the service. Note that setting this
226 option to true does not force DNSSEC validation on systems/networks
227 where DNSSEC is turned off. This option is only suitable to turn
228 off such validation where otherwise enabled, not enable validation
229 where otherwise disabled.
230
231 --synthesize=BOOL
232 Takes a boolean parameter; used in conjunction with query. If true
233 (the default), select domains are resolved on the local system,
234 among them "localhost", "_gateway", "_outbound", "_localdnsstub"
235 and "_localdnsproxy" or entries from /etc/hosts. If false these
236 domains are not resolved locally, and either fail (in case of
237 "localhost", "_gateway" or "_outbound" and suchlike) or go to the
238 network via regular DNS/mDNS/LLMNR lookups (in case of /etc/hosts
239 entries).
240
241 --cache=BOOL
242 Takes a boolean parameter; used in conjunction with query. If true
243 (the default), lookups use the local DNS resource record cache. If
244 false, lookups are routed to the network instead, regardless if
245 already available in the local cache.
246
247 --zone=BOOL
248 Takes a boolean parameter; used in conjunction with query. If true
249 (the default), lookups are answered from locally registered LLMNR
250 or mDNS resource records, if defined. If false, locally registered
251 LLMNR/mDNS records are not considered for the lookup request.
252
253 --trust-anchor=BOOL
254 Takes a boolean parameter; used in conjunction with query. If true
255 (the default), lookups for DS and DNSKEY are answered from the
256 local DNSSEC trust anchors if possible. If false, the local trust
257 store is not considered for the lookup request.
258
259 --network=BOOL
260 Takes a boolean parameter; used in conjunction with query. If true
261 (the default), lookups are answered via DNS, LLMNR or mDNS network
262 requests if they cannot be synthesized locally, or be answered from
263 the local cache, zone or trust anchors (see above). If false, the
264 request is not answered from the network and will thus fail if none
265 of the indicated sources can answer them.
266
267 --search=BOOL
268 Takes a boolean parameter. If true (the default), any specified
269 single-label hostnames will be searched in the domains configured
270 in the search domain list, if it is non-empty. Otherwise, the
271 search domain logic is disabled. Note that this option has no
272 effect if --type= is used (see above), in which case the search
273 domain logic is unconditionally turned off.
274
275 --raw[=payload|packet]
276 Dump the answer as binary data. If there is no argument or if the
277 argument is "payload", the payload of the packet is exported. If
278 the argument is "packet", the whole packet is dumped in wire
279 format, prefixed by length specified as a little-endian 64-bit
280 number. This format allows multiple packets to be dumped and
281 unambiguously parsed.
282
283 --legend=BOOL
284 Takes a boolean parameter. If true (the default), column headers
285 and meta information about the query response are shown. Otherwise,
286 this output is suppressed.
287
288 --json=MODE
289 Shows output formatted as JSON. Expects one of "short" (for the
290 shortest possible output without any redundant whitespace or line
291 breaks), "pretty" (for a pretty version of the same, with
292 indentation and line breaks) or "off" (to turn off JSON output, the
293 default).
294
295 -j
296 Short for --json=auto
297
298 --no-pager
299 Do not pipe output into a pager.
300
301 -h, --help
302 Print a short help text and exit.
303
304 --version
305 Print a short version string and exit.
306
308 resolvectl is a multi-call binary. When invoked as "resolvconf"
309 (generally achieved by means of a symbolic link of this name to the
310 resolvectl binary) it is run in a limited resolvconf(8) compatibility
311 mode. It accepts mostly the same arguments and pushes all data into
312 systemd-resolved.service(8), similar to how dns and domain commands
313 operate. Note that systemd-resolved.service is the only supported
314 backend, which is different from other implementations of this command.
315
316 /etc/resolv.conf will only be updated with servers added with this
317 command when /etc/resolv.conf is a symlink to
318 /run/systemd/resolve/resolv.conf, and not a static file. See the
319 discussion of /etc/resolv.conf handling in systemd-resolved.service(8).
320
321 Not all operations supported by other implementations are supported
322 natively. Specifically:
323
324 -a
325 Registers per-interface DNS configuration data with
326 systemd-resolved. Expects a network interface name as only command
327 line argument. Reads resolv.conf(5)-compatible DNS configuration
328 data from its standard input. Relevant fields are "nameserver" and
329 "domain"/"search". This command is mostly identical to invoking
330 resolvectl with a combination of dns and domain commands.
331
332 -d
333 Unregisters per-interface DNS configuration data with
334 systemd-resolved. This command is mostly identical to invoking
335 resolvectl revert.
336
337 -f
338 When specified -a and -d will not complain about missing network
339 interfaces and will silently execute no operation in that case.
340
341 -x
342 This switch for "exclusive" operation is supported only partially.
343 It is mapped to an additional configured search domain of "~." —
344 i.e. ensures that DNS traffic is preferably routed to the DNS
345 servers on this interface, unless there are other, more specific
346 domains configured on other interfaces.
347
348 -m, -p
349 These switches are not supported and are silently ignored.
350
351 -u, -I, -i, -l, -R, -r, -v, -V, --enable-updates, --disable-updates,
352 --are-updates-enabled
353 These switches are not supported and the command will fail if used.
354
355 See resolvconf(8) for details on those command line options.
356
358 Example 1. Retrieve the addresses of the "www.0pointer.net" domain (A
359 and AAAA resource records)
360
361 $ resolvectl query www.0pointer.net
362 www.0pointer.net: 2a01:238:43ed:c300:10c3:bcf3:3266:da74
363 85.214.157.71
364
365 -- Information acquired via protocol DNS in 611.6ms.
366 -- Data is authenticated: no
367
368 Example 2. Retrieve the domain of the "85.214.157.71" IP address (PTR
369 resource record)
370
371 $ resolvectl query 85.214.157.71
372 85.214.157.71: gardel.0pointer.net
373
374 -- Information acquired via protocol DNS in 1.2997s.
375 -- Data is authenticated: no
376
377 Example 3. Retrieve the MX record of the "yahoo.com" domain
378
379 $ resolvectl --legend=no -t MX query yahoo.com
380 yahoo.com. IN MX 1 mta7.am0.yahoodns.net
381 yahoo.com. IN MX 1 mta6.am0.yahoodns.net
382 yahoo.com. IN MX 1 mta5.am0.yahoodns.net
383
384 Example 4. Resolve an SRV service
385
386 $ resolvectl service _xmpp-server._tcp gmail.com
387 _xmpp-server._tcp/gmail.com: alt1.xmpp-server.l.google.com:5269 [priority=20, weight=0]
388 173.194.210.125
389 alt4.xmpp-server.l.google.com:5269 [priority=20, weight=0]
390 173.194.65.125
391 ...
392
393 Example 5. Retrieve a PGP key (OPENPGP resource record)
394
395 $ resolvectl openpgp zbyszek@fedoraproject.org
396 d08ee310438ca124a6149ea5cc21b6313b390dce485576eff96f8722._openpgpkey.fedoraproject.org. IN OPENPGPKEY
397 mQINBFBHPMsBEACeInGYJCb+7TurKfb6wGyTottCDtiSJB310i37/6ZYoeIay/5soJjlMyf
398 MFQ9T2XNT/0LM6gTa0MpC1st9LnzYTMsT6tzRly1D1UbVI6xw0g0vE5y2Cjk3xUwAynCsSs
399 ...
400
401 Example 6. Retrieve a TLS key (TLSA resource record)
402
403 $ resolvectl tlsa tcp fedoraproject.org:443
404 _443._tcp.fedoraproject.org IN TLSA 0 0 1 19400be5b7a31fb733917700789d2f0a2471c0c9d506c0e504c06c16d7cb17c0
405 -- Cert. usage: CA constraint
406 -- Selector: Full Certificate
407 -- Matching type: SHA-256
408
409 "tcp" and ":443" are optional and could be skipped.
410
412 systemd(1), systemd-resolved.service(8), systemd.dnssd(5), systemd-
413 networkd.service(8), resolvconf(8)
414
416 1. DNS-SD
417 https://tools.ietf.org/html/rfc6763
418
419 2. SRV
420 https://tools.ietf.org/html/rfc2782
421
422 3. RFC 7929
423 https://tools.ietf.org/html/rfc7929
424
425 4. RFC 6698
426 https://tools.ietf.org/html/rfc6698
427
428 5. Link-Local Multicast Name Resolution
429 https://tools.ietf.org/html/rfc4795
430
431 6. Multicast DNS
432 https://www.ietf.org/rfc/rfc6762.txt
433
434
435
436systemd 253 RESOLVECTL(1)