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 show-cache
150 Show current cache content, per scope. Use --json= to enable JSON
151 output.
152
153 log-level [LEVEL]
154 If no argument is given, print the current log level of the
155 manager. If an optional argument LEVEL is provided, then the
156 command changes the current log level of the manager to LEVEL
157 (accepts the same values as --log-level= described in systemd(1)).
158
160 -4, -6
161 By default, when resolving a hostname, both IPv4 and IPv6 addresses
162 are acquired. By specifying -4 only IPv4 addresses are requested,
163 by specifying -6 only IPv6 addresses are requested.
164
165 -i INTERFACE, --interface=INTERFACE
166 Specifies the network interface to execute the query on. This may
167 either be specified as numeric interface index or as network
168 interface string (e.g. "en0"). Note that this option has no effect
169 if system-wide DNS configuration (as configured in /etc/resolv.conf
170 or /etc/systemd/resolved.conf) in place of per-link configuration
171 is used.
172
173 -p PROTOCOL, --protocol=PROTOCOL
174 Specifies the network protocol for the query. May be one of "dns"
175 (i.e. classic unicast DNS), "llmnr" (Link-Local Multicast Name
176 Resolution[5]), "llmnr-ipv4", "llmnr-ipv6" (LLMNR via the indicated
177 underlying IP protocols), "mdns" (Multicast DNS[6]), "mdns-ipv4",
178 "mdns-ipv6" (MDNS via the indicated underlying IP protocols). By
179 default the lookup is done via all protocols suitable for the
180 lookup. If used, limits the set of protocols that may be used. Use
181 this option multiple times to enable resolving via multiple
182 protocols at the same time. The setting "llmnr" is identical to
183 specifying this switch once with "llmnr-ipv4" and once via
184 "llmnr-ipv6". Note that this option does not force the service to
185 resolve the operation with the specified protocol, as that might
186 require a suitable network interface and configuration. The special
187 value "help" may be used to list known values.
188
189 -t TYPE, --type=TYPE, -c CLASS, --class=CLASS
190 When used in conjunction with the query command, specifies the DNS
191 resource record type (e.g. A, AAAA, MX, ...) and class (e.g. IN,
192 ANY, ...) to look up. If these options are used a DNS resource
193 record set matching the specified class and type is requested. The
194 class defaults to IN if only a type is specified. The special value
195 "help" may be used to list known values.
196
197 Without these options resolvectl query provides high-level domain
198 name to address and address to domain name resolution. With these
199 options it provides low-level DNS resource record resolution. The
200 search domain logic is automatically turned off when these options
201 are used, i.e. specified domain names need to be fully qualified
202 domain names. Moreover, IDNA internal domain name translation is
203 turned off as well, i.e. international domain names should be
204 specified in "xn--..." notation, unless look-up in
205 MulticastDNS/LLMNR is desired, in which case UTF-8 characters
206 should be used.
207
208 --service-address=BOOL
209 Takes a boolean parameter. If true (the default), when doing a
210 service lookup with --service the hostnames contained in the SRV
211 resource records are resolved as well.
212
213 --service-txt=BOOL
214 Takes a boolean parameter. If true (the default), when doing a
215 DNS-SD service lookup with --service the TXT service metadata
216 record is resolved as well.
217
218 --cname=BOOL
219 Takes a boolean parameter. If true (the default), DNS CNAME or
220 DNAME redirections are followed. Otherwise, if a CNAME or DNAME
221 record is encountered while resolving, an error is returned.
222
223 --validate=BOOL
224 Takes a boolean parameter; used in conjunction with query. If true
225 (the default), DNSSEC validation is applied as usual — under the
226 condition that it is enabled for the network and for
227 systemd-resolved.service as a whole. If false, DNSSEC validation is
228 disabled for the specific query, regardless of whether it is
229 enabled for the network or in the service. Note that setting this
230 option to true does not force DNSSEC validation on systems/networks
231 where DNSSEC is turned off. This option is only suitable to turn
232 off such validation where otherwise enabled, not enable validation
233 where otherwise disabled.
234
235 --synthesize=BOOL
236 Takes a boolean parameter; used in conjunction with query. If true
237 (the default), select domains are resolved on the local system,
238 among them "localhost", "_gateway", "_outbound", "_localdnsstub"
239 and "_localdnsproxy" or entries from /etc/hosts. If false these
240 domains are not resolved locally, and either fail (in case of
241 "localhost", "_gateway" or "_outbound" and suchlike) or go to the
242 network via regular DNS/mDNS/LLMNR lookups (in case of /etc/hosts
243 entries).
244
245 --cache=BOOL
246 Takes a boolean parameter; used in conjunction with query. If true
247 (the default), lookups use the local DNS resource record cache. If
248 false, lookups are routed to the network instead, regardless if
249 already available in the local cache.
250
251 --zone=BOOL
252 Takes a boolean parameter; used in conjunction with query. If true
253 (the default), lookups are answered from locally registered LLMNR
254 or mDNS resource records, if defined. If false, locally registered
255 LLMNR/mDNS records are not considered for the lookup request.
256
257 --trust-anchor=BOOL
258 Takes a boolean parameter; used in conjunction with query. If true
259 (the default), lookups for DS and DNSKEY are answered from the
260 local DNSSEC trust anchors if possible. If false, the local trust
261 store is not considered for the lookup request.
262
263 --network=BOOL
264 Takes a boolean parameter; used in conjunction with query. If true
265 (the default), lookups are answered via DNS, LLMNR or mDNS network
266 requests if they cannot be synthesized locally, or be answered from
267 the local cache, zone or trust anchors (see above). If false, the
268 request is not answered from the network and will thus fail if none
269 of the indicated sources can answer them.
270
271 --search=BOOL
272 Takes a boolean parameter. If true (the default), any specified
273 single-label hostnames will be searched in the domains configured
274 in the search domain list, if it is non-empty. Otherwise, the
275 search domain logic is disabled. Note that this option has no
276 effect if --type= is used (see above), in which case the search
277 domain logic is unconditionally turned off.
278
279 --raw[=payload|packet]
280 Dump the answer as binary data. If there is no argument or if the
281 argument is "payload", the payload of the packet is exported. If
282 the argument is "packet", the whole packet is dumped in wire
283 format, prefixed by length specified as a little-endian 64-bit
284 number. This format allows multiple packets to be dumped and
285 unambiguously parsed.
286
287 --legend=BOOL
288 Takes a boolean parameter. If true (the default), column headers
289 and meta information about the query response are shown. Otherwise,
290 this output is suppressed.
291
292 --stale-data=BOOL
293 Takes a boolean parameter; used in conjunction with query. If true
294 (the default), lookups are answered with stale data (expired
295 resource records) if possible. If false, the stale data is not
296 considered for the lookup request.
297
298 --json=MODE
299 Shows output formatted as JSON. Expects one of "short" (for the
300 shortest possible output without any redundant whitespace or line
301 breaks), "pretty" (for a pretty version of the same, with
302 indentation and line breaks) or "off" (to turn off JSON output, the
303 default).
304
305 -j
306 Short for --json=auto
307
308 --no-pager
309 Do not pipe output into a pager.
310
311 -h, --help
312 Print a short help text and exit.
313
314 --version
315 Print a short version string and exit.
316
318 resolvectl is a multi-call binary. When invoked as "resolvconf"
319 (generally achieved by means of a symbolic link of this name to the
320 resolvectl binary) it is run in a limited resolvconf(8) compatibility
321 mode. It accepts mostly the same arguments and pushes all data into
322 systemd-resolved.service(8), similar to how dns and domain commands
323 operate. Note that systemd-resolved.service is the only supported
324 backend, which is different from other implementations of this command.
325
326 /etc/resolv.conf will only be updated with servers added with this
327 command when /etc/resolv.conf is a symlink to
328 /run/systemd/resolve/resolv.conf, and not a static file. See the
329 discussion of /etc/resolv.conf handling in systemd-resolved.service(8).
330
331 Not all operations supported by other implementations are supported
332 natively. Specifically:
333
334 -a
335 Registers per-interface DNS configuration data with
336 systemd-resolved. Expects a network interface name as only command
337 line argument. Reads resolv.conf(5)-compatible DNS configuration
338 data from its standard input. Relevant fields are "nameserver" and
339 "domain"/"search". This command is mostly identical to invoking
340 resolvectl with a combination of dns and domain commands.
341
342 -d
343 Unregisters per-interface DNS configuration data with
344 systemd-resolved. This command is mostly identical to invoking
345 resolvectl revert.
346
347 -f
348 When specified -a and -d will not complain about missing network
349 interfaces and will silently execute no operation in that case.
350
351 -x
352 This switch for "exclusive" operation is supported only partially.
353 It is mapped to an additional configured search domain of "~." —
354 i.e. ensures that DNS traffic is preferably routed to the DNS
355 servers on this interface, unless there are other, more specific
356 domains configured on other interfaces.
357
358 -m, -p
359 These switches are not supported and are silently ignored.
360
361 -u, -I, -i, -l, -R, -r, -v, -V, --enable-updates, --disable-updates,
362 --are-updates-enabled
363 These switches are not supported and the command will fail if used.
364
365 See resolvconf(8) for details on those command line options.
366
368 Example 1. Retrieve the addresses of the "www.0pointer.net" domain (A
369 and AAAA resource records)
370
371 $ resolvectl query www.0pointer.net
372 www.0pointer.net: 2a01:238:43ed:c300:10c3:bcf3:3266:da74
373 85.214.157.71
374
375 -- Information acquired via protocol DNS in 611.6ms.
376 -- Data is authenticated: no
377
378 Example 2. Retrieve the domain of the "85.214.157.71" IP address (PTR
379 resource record)
380
381 $ resolvectl query 85.214.157.71
382 85.214.157.71: gardel.0pointer.net
383
384 -- Information acquired via protocol DNS in 1.2997s.
385 -- Data is authenticated: no
386
387 Example 3. Retrieve the MX record of the "yahoo.com" domain
388
389 $ resolvectl --legend=no -t MX query yahoo.com
390 yahoo.com. IN MX 1 mta7.am0.yahoodns.net
391 yahoo.com. IN MX 1 mta6.am0.yahoodns.net
392 yahoo.com. IN MX 1 mta5.am0.yahoodns.net
393
394 Example 4. Resolve an SRV service
395
396 $ resolvectl service _xmpp-server._tcp gmail.com
397 _xmpp-server._tcp/gmail.com: alt1.xmpp-server.l.google.com:5269 [priority=20, weight=0]
398 173.194.210.125
399 alt4.xmpp-server.l.google.com:5269 [priority=20, weight=0]
400 173.194.65.125
401 ...
402
403 Example 5. Retrieve a PGP key (OPENPGP resource record)
404
405 $ resolvectl openpgp zbyszek@fedoraproject.org
406 d08ee310438ca124a6149ea5cc21b6313b390dce485576eff96f8722._openpgpkey.fedoraproject.org. IN OPENPGPKEY
407 mQINBFBHPMsBEACeInGYJCb+7TurKfb6wGyTottCDtiSJB310i37/6ZYoeIay/5soJjlMyf
408 MFQ9T2XNT/0LM6gTa0MpC1st9LnzYTMsT6tzRly1D1UbVI6xw0g0vE5y2Cjk3xUwAynCsSs
409 ...
410
411 Example 6. Retrieve a TLS key (TLSA resource record)
412
413 $ resolvectl tlsa tcp fedoraproject.org:443
414 _443._tcp.fedoraproject.org IN TLSA 0 0 1 19400be5b7a31fb733917700789d2f0a2471c0c9d506c0e504c06c16d7cb17c0
415 -- Cert. usage: CA constraint
416 -- Selector: Full Certificate
417 -- Matching type: SHA-256
418
419 "tcp" and ":443" are optional and could be skipped.
420
422 systemd(1), systemd-resolved.service(8), systemd.dnssd(5), systemd-
423 networkd.service(8), resolvconf(8)
424
426 1. DNS-SD
427 https://tools.ietf.org/html/rfc6763
428
429 2. SRV
430 https://tools.ietf.org/html/rfc2782
431
432 3. RFC 7929
433 https://tools.ietf.org/html/rfc7929
434
435 4. RFC 6698
436 https://tools.ietf.org/html/rfc6698
437
438 5. Link-Local Multicast Name Resolution
439 https://tools.ietf.org/html/rfc4795
440
441 6. Multicast DNS
442 https://www.ietf.org/rfc/rfc6762.txt
443
444
445
446systemd 254 RESOLVECTL(1)