Debian Codegraph @

doc/man/dig.1in

raw
1 .\" Man page generated from reStructuredText
2 .\" by the Docutils 0.22.4 manpage writer.
3 .
4 .
5 .nr rst2man-indent-level 0
6 .
7 .de1 rstReportMargin
8 \\$1 \\n[an-margin]
9 level \\n[rst2man-indent-level]
10 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
11 -
12 \\n[rst2man-indent0]
13 \\n[rst2man-indent1]
14 \\n[rst2man-indent2]
15 ..
16 .de1 INDENT
17 .\" .rstReportMargin pre:
18 . RS \\$1
19 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
20 . nr rst2man-indent-level +1
21 .\" .rstReportMargin post:
22 ..
23 .de UNINDENT
24 . RE
25 .\" indent \\n[an-margin]
26 .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
27 .nr rst2man-indent-level -1
28 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
29 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
30 ..
31 .TH "DIG" "1" "@RELEASE_DATE@" "@PACKAGE_VERSION@" "BIND 9"
32 .SH NAME
33 dig \- DNS lookup utility
34 .SH SYNOPSIS
35 .sp
36 \fBdig\fP [@server] [\fB\-b\fP address] [\fB\-c\fP class] [\fB\-f\fP filename] [\fB\-k\fP filename] [\fB\-m\fP] [\fB\-p\fP port#] [\fB\-q\fP name] [\fB\-t\fP type] [\fB\-v\fP] [\fB\-x\fP addr] [\fB\-y\fP [hmac:]name:key] [ [\fB\-4\fP] | [\fB\-6\fP] ] [name] [type] [class] [queryopt...]
37 .sp
38 \fBdig\fP [\fB\-h\fP]
39 .sp
40 \fBdig\fP [global\-queryopt...] [query...]
41 .SH DESCRIPTION
42 .sp
43 \fBdig\fP is a flexible tool for interrogating DNS name servers. It
44 performs DNS lookups and displays the answers that are returned from the
45 name server(s) that were queried. Most DNS administrators use \fBdig\fP to
46 troubleshoot DNS problems because of its flexibility, ease of use, and
47 clarity of output. Other lookup tools tend to have less functionality
48 than \fBdig\fP\&.
49 .sp
50 Although \fBdig\fP is normally used with command\-line arguments, it also
51 has a batch mode of operation for reading lookup requests from a file. A
52 brief summary of its command\-line arguments and options is printed when
53 the \fB\-h\fP option is given. The BIND 9
54 implementation of \fBdig\fP allows multiple lookups to be issued from the
55 command line.
56 .sp
57 Unless it is told to query a specific name server, \fBdig\fP tries each
58 of the servers listed in \fB/etc/resolv.conf\fP\&. If no usable server
59 addresses are found, \fBdig\fP sends the query to the local host.
60 .sp
61 When no command\-line arguments or options are given, \fBdig\fP
62 performs an NS query for \(dq.\(dq (the root).
63 .sp
64 It is possible to set per\-user defaults for \fBdig\fP via
65 \fB${HOME}/.digrc\fP\&. This file is read and any options in it are applied
66 before the command\-line arguments. The \fB\-r\fP option disables this
67 feature, for scripts that need predictable behavior.
68 .sp
69 The IN and CH class names overlap with the IN and CH top\-level domain
70 names. Either use the \fB\-t\fP and \fB\-c\fP options to specify the type and
71 class, use the \fB\-q\fP to specify the domain name, or use \(dqIN.\(dq and
72 \(dqCH.\(dq when looking up these top\-level domains.
73 .SH SIMPLE USAGE
74 .sp
75 A typical invocation of \fBdig\fP looks like:
76 .INDENT 0.0
77 .INDENT 3.5
78 .sp
79 .EX
80 dig @server name type
81 .EE
82 .UNINDENT
83 .UNINDENT
84 .sp
85 where:
86 .INDENT 0.0
87 .TP
88 .B server
89 is the name or IP address of the name server to query. This can be an
90 IPv4 address in dotted\-decimal notation or an IPv6 address in
91 colon\-delimited notation. When the supplied \fBserver\fP argument is a
92 hostname, \fBdig\fP resolves that name before querying that name
93 server.
94 .sp
95 If no \fBserver\fP argument is provided, \fBdig\fP consults
96 \fB/etc/resolv.conf\fP; if an address is found there, it queries the
97 name server at that address. If either of the \fB\-4\fP or \fB\-6\fP
98 options are in use, then only addresses for the corresponding
99 transport are tried. If no usable addresses are found, \fBdig\fP
100 sends the query to the local host. The reply from the name server
101 that responds is displayed.
102 .UNINDENT
103 .INDENT 0.0
104 .TP
105 .B name
106 is the name of the resource record that is to be looked up.
107 .UNINDENT
108 .INDENT 0.0
109 .TP
110 .B type
111 indicates what type of query is required \- ANY, A, MX, SIG, etc.
112 \fBtype\fP can be any valid query type. If no \fBtype\fP argument is
113 supplied, \fBdig\fP performs a lookup for an A record.
114 .UNINDENT
115 .SH OPTIONS
116 .INDENT 0.0
117 .TP
118 .B \-4
119 This option indicates that only IPv4 should be used.
120 .UNINDENT
121 .INDENT 0.0
122 .TP
123 .B \-6
124 This option indicates that only IPv6 should be used.
125 .UNINDENT
126 .INDENT 0.0
127 .TP
128 .B \-b address[#port]
129 This option sets the source IP address of the query. The \fBaddress\fP must be a
130 valid address on one of the host\(aqs network interfaces, or \(dq0.0.0.0\(dq
131 or \(dq::\(dq. An optional port may be specified by appending \fB#port\fP\&.
132 .UNINDENT
133 .INDENT 0.0
134 .TP
135 .B \-c class
136 This option sets the query class. The default \fBclass\fP is IN; other classes are
137 HS for Hesiod records or CH for Chaosnet records.
138 .UNINDENT
139 .INDENT 0.0
140 .TP
141 .B \-f file
142 This option sets batch mode, in which \fBdig\fP reads a list of lookup requests to process from
143 the given \fBfile\fP\&. Each line in the file should be organized in the
144 same way it would be presented as a query to \fBdig\fP using the
145 command\-line interface.
146 .UNINDENT
147 .INDENT 0.0
148 .TP
149 .B \-h
150 Print a usage summary.
151 .UNINDENT
152 .INDENT 0.0
153 .TP
154 .B \-k keyfile
155 This option tells \fBdig\fP to sign queries using TSIG or
156 SIG(0) using a key read from the given file. Key files can be
157 generated using \fBtsig\-keygen\fP \%<#\:std-iscman-tsig-keygen>\&. When using TSIG authentication
158 with \fBdig\fP, the name server that is queried needs to
159 know the key and algorithm that is being used. In BIND, this is
160 done by providing appropriate \fBkey\fP and \fBserver\fP statements
161 in \fBnamed.conf\fP \%<#\:std-iscman-named\:.conf> for TSIG and by looking up the KEY record
162 in zone data for SIG(0).
163 .UNINDENT
164 .INDENT 0.0
165 .TP
166 .B \-m
167 This option enables memory usage debugging.
168 .UNINDENT
169 .INDENT 0.0
170 .TP
171 .B \-p port
172 This option sends the query to a non\-standard port on the server, instead of the
173 default port 53. This option is used to test a name server that
174 has been configured to listen for queries on a non\-standard port
175 number.
176 .UNINDENT
177 .INDENT 0.0
178 .TP
179 .B \-q name
180 This option specifies the domain name to query. This is useful to distinguish the \fBname\fP
181 from other arguments.
182 .UNINDENT
183 .INDENT 0.0
184 .TP
185 .B \-r
186 This option indicates that options from \fB${HOME}/.digrc\fP should not be read. This is useful for
187 scripts that need predictable behavior.
188 .UNINDENT
189 .INDENT 0.0
190 .TP
191 .B \-t type
192 This option indicates the resource record type to query, which can be any valid query type. If
193 it is a resource record type supported in BIND 9, it can be given by
194 the type mnemonic (such as \fBNS\fP or \fBAAAA\fP). The default query type is
195 \fBA\fP, unless the \fB\-x\fP option is supplied to indicate a reverse
196 lookup. A zone transfer can be requested by specifying a type of
197 AXFR. When an incremental zone transfer (IXFR) is required, set the
198 \fBtype\fP to \fBixfr=N\fP\&. The incremental zone transfer contains
199 all changes made to the zone since the serial number in the zone\(aqs
200 SOA record was \fBN\fP\&.
201 .sp
202 All resource record types can be expressed as \fBTYPEnn\fP, where \fBnn\fP is
203 the number of the type. If the resource record type is not supported
204 in BIND 9, the result is displayed as described in \fBRFC 3597\fP \%<https://\:datatracker\:.ietf\:.org/\:doc/\:html/\:rfc3597\:.html>\&.
205 .UNINDENT
206 .INDENT 0.0
207 .TP
208 .B \-u
209 This option indicates that print query times should be provided in microseconds instead of milliseconds.
210 .UNINDENT
211 .INDENT 0.0
212 .TP
213 .B \-v
214 This option prints the version number and exits.
215 .UNINDENT
216 .INDENT 0.0
217 .TP
218 .B \-x addr
219 This option sets simplified reverse lookups, for mapping addresses to names. The
220 \fBaddr\fP is an IPv4 address in dotted\-decimal notation, or a
221 colon\-delimited IPv6 address. When the \fB\-x\fP option is used, there is no
222 need to provide the \fBname\fP, \fBclass\fP, and \fBtype\fP arguments.
223 \fBdig\fP automatically performs a lookup for a name like
224 \fB94.2.0.192.in\-addr.arpa\fP and sets the query type and class to PTR
225 and IN respectively. IPv6 addresses are looked up using nibble format
226 under the IP6.ARPA domain.
227 .UNINDENT
228 .INDENT 0.0
229 .TP
230 .B \-y [hmac:]keyname:secret
231 This option signs queries using TSIG with the given authentication key.
232 \fBkeyname\fP is the name of the key, and \fBsecret\fP is the
233 base64\-encoded shared secret. \fBhmac\fP is the name of the key algorithm;
234 valid choices are \fBhmac\-md5\fP, \fBhmac\-sha1\fP, \fBhmac\-sha224\fP,
235 \fBhmac\-sha256\fP, \fBhmac\-sha384\fP, or \fBhmac\-sha512\fP\&. If \fBhmac\fP is
236 not specified, the default is \fBhmac\-md5\fP; if MD5 was disabled, the default is
237 \fBhmac\-sha256\fP\&.
238 .UNINDENT
239 .sp
240 \fBNote:\fP
241 .INDENT 0.0
242 .INDENT 3.5
243 Only the \fB\-k\fP option should be used, rather than the \fB\-y\fP option,
244 because with \fB\-y\fP the shared secret is supplied as a command\-line
245 argument in clear text. This may be visible in the output from \fBps1\fP or
246 in a history file maintained by the user\(aqs shell.
247 .UNINDENT
248 .UNINDENT
249 .SH QUERY OPTIONS
250 .sp
251 \fBdig\fP provides a number of query options which affect the way in which
252 lookups are made and the results displayed. Some of these set or reset
253 flag bits in the query header, some determine which sections of the
254 answer get printed, and others determine the timeout and retry
255 strategies.
256 .sp
257 Each query option is identified by a keyword preceded by a plus sign
258 (\fB+\fP). Some keywords set or reset an option; these may be preceded by
259 the string \fBno\fP to negate the meaning of that keyword. Other keywords
260 assign values to options, like the timeout interval. They have the form
261 \fB+keyword=value\fP\&. Keywords may be abbreviated, provided the
262 abbreviation is unambiguous; for example, \fB+cd\fP is equivalent to
263 \fB+cdflag\fP\&. Query options are order sensitive. The query options are:
264 .INDENT 0.0
265 .TP
266 .B +aaflag, +noaaflag
267 This option is a synonym for \fB+aaonly\fP, \fB+noaaonly\fP\&.
268 .UNINDENT
269 .INDENT 0.0
270 .TP
271 .B +aaonly, +noaaonly
272 This option sets the \fBaa\fP flag in the query.
273 .UNINDENT
274 .INDENT 0.0
275 .TP
276 .B +additional, +noadditional
277 This option displays [or does not display] the additional section of a reply. The
278 default is to display it.
279 .UNINDENT
280 .INDENT 0.0
281 .TP
282 .B +adflag, +noadflag
283 This option sets [or does not set] the AD (authentic data) bit in the query. This
284 requests the server to return whether all of the answer and authority
285 sections have been validated as secure, according to the security
286 policy of the server. \fBAD=1\fP indicates that all records have been
287 validated as secure and the answer is not from a OPT\-OUT range. \fBAD=0\fP
288 indicates that some part of the answer was insecure or not validated.
289 This bit is set by default.
290 .UNINDENT
291 .INDENT 0.0
292 .TP
293 .B +all, +noall
294 This option sets or clears all display flags.
295 .UNINDENT
296 .INDENT 0.0
297 .TP
298 .B +answer, +noanswer
299 This option displays [or does not display] the answer section of a reply. The default
300 is to display it.
301 .UNINDENT
302 .INDENT 0.0
303 .TP
304 .B +authority, +noauthority
305 This option displays [or does not display] the authority section of a reply. The
306 default is to display it.
307 .UNINDENT
308 .INDENT 0.0
309 .TP
310 .B +badcookie, +nobadcookie
311 This option retries the lookup with a new server cookie if a BADCOOKIE response is
312 received.
313 .UNINDENT
314 .INDENT 0.0
315 .TP
316 .B +besteffort, +nobesteffort
317 This option attempts to display the contents of messages which are malformed. The
318 default is to not display malformed answers.
319 .UNINDENT
320 .INDENT 0.0
321 .TP
322 .B +bufsize[=B]
323 This option sets the UDP message buffer size advertised using EDNS0 to
324 \fBB\fP bytes. The maximum and minimum sizes of this buffer are 65535 and
325 0, respectively. \fB+bufsize\fP restores the default buffer size.
326 .UNINDENT
327 .INDENT 0.0
328 .TP
329 .B +cd, +cdflag, +nocdflag
330 This option sets [or does not set] the CD (checking disabled) bit in the query. This
331 requests the server to not perform DNSSEC validation of responses.
332 .UNINDENT
333 .INDENT 0.0
334 .TP
335 .B +class, +noclass
336 This option displays [or does not display] the CLASS when printing the record.
337 .UNINDENT
338 .INDENT 0.0
339 .TP
340 .B +cmd, +nocmd
341 This option toggles the printing of the initial comment in the output, identifying the
342 version of \fBdig\fP and the query options that have been applied. This option
343 always has a global effect; it cannot be set globally and then overridden on a
344 per\-lookup basis. The default is to print this comment.
345 .UNINDENT
346 .INDENT 0.0
347 .TP
348 .B +coflag, +co, +nocoflag, +noco
349 This option sets [or does not set] the CO (Compact denial of
350 existence Ok) EDNS bit in the query. If set, it tells servers
351 that Compact Denial of Existence responses are acceptable when
352 replying to queries. The default is \fB+nocoflag\fP\&.
353 .UNINDENT
354 .INDENT 0.0
355 .TP
356 .B +comments, +nocomments
357 This option toggles the display of some comment lines in the output, with
358 information about the packet header and OPT pseudosection, and the names of
359 the response section. The default is to print these comments.
360 .sp
361 Other types of comments in the output are not affected by this option, but
362 can be controlled using other command\-line switches. These include
363 \fB+cmd\fP, \fB+question\fP, \fB+stats\fP, and \fB+rrcomments\fP\&.
364 .UNINDENT
365 .INDENT 0.0
366 .TP
367 .B +cookie=####, +nocookie
368 This option sends [or does not send] a COOKIE EDNS option, with an optional value. Replaying a COOKIE
369 from a previous response allows the server to identify a previous
370 client. The default is \fB+cookie\fP\&.
371 .sp
372 \fB+cookie\fP is also set when \fB+trace\fP is set to better emulate the
373 default queries from a nameserver.
374 .UNINDENT
375 .INDENT 0.0
376 .TP
377 .B +crypto, +nocrypto
378 This option toggles the display of cryptographic fields in DNSSEC records. The
379 contents of these fields are unnecessary for debugging most DNSSEC
380 validation failures and removing them makes it easier to see the
381 common failures. The default is to display the fields. When omitted,
382 they are replaced by the string \fB[omitted]\fP or, in the DNSKEY case, the
383 key ID is displayed as the replacement, e.g. \fB[ key id = value ]\fP\&.
384 .UNINDENT
385 .INDENT 0.0
386 .TP
387 .B +defname, +nodefname
388 This option, which is deprecated, is treated as a synonym for
389 \fB+search\fP, \fB+nosearch\fP\&.
390 .UNINDENT
391 .INDENT 0.0
392 .TP
393 .B +dns64prefix, +nodns64prefix
394 Lookup IPV4ONLY.ARPA AAAA and print any DNS64 prefixes found.
395 .UNINDENT
396 .INDENT 0.0
397 .TP
398 .B +dnssec, +do, +nodnssec, +nodo
399 This option requests that DNSSEC records be sent by setting the DNSSEC OK (DO) bit in
400 the OPT record in the additional section of the query.
401 .UNINDENT
402 .INDENT 0.0
403 .TP
404 .B +domain=somename
405 This option sets the search list to contain the single domain \fBsomename\fP, as if
406 specified in a \fBdomain\fP directive in \fB/etc/resolv.conf\fP, and
407 enables search list processing as if the \fB+search\fP option were
408 given.
409 .UNINDENT
410 .INDENT 0.0
411 .TP
412 .B +edns[=#], +noedns
413 This option specifies the EDNS version to query with. Valid values are 0 to 255.
414 Setting the EDNS version causes an EDNS query to be sent.
415 \fB+noedns\fP clears the remembered EDNS version. EDNS is set to 0 by
416 default.
417 .UNINDENT
418 .INDENT 0.0
419 .TP
420 .B +ednsflags[=#], +noednsflags
421 This option sets the must\-be\-zero EDNS flags bits (Z bits) to the specified value.
422 Decimal, hex, and octal encodings are accepted. Setting a named flag
423 (e.g. DO, CO) is silently ignored. By default, no Z bits are set.
424 .UNINDENT
425 .INDENT 0.0
426 .TP
427 .B +ednsnegotiation, +noednsnegotiation
428 This option enables/disables EDNS version negotiation. By default, EDNS version
429 negotiation is enabled.
430 .UNINDENT
431 .INDENT 0.0
432 .TP
433 .B +ednsopt[=code[:value]], +noednsopt
434 This option specifies the EDNS option with code point \fBcode\fP and an optional payload
435 of \fBvalue\fP as a hexadecimal string. \fBcode\fP can be either an EDNS
436 option name (for example, \fBNSID\fP or \fBECS\fP) or an arbitrary
437 numeric value. \fB+noednsopt\fP clears the EDNS options to be sent.
438 .UNINDENT
439 .INDENT 0.0
440 .TP
441 .B +expire, +noexpire
442 This option sends an EDNS Expire option.
443 .UNINDENT
444 .INDENT 0.0
445 .TP
446 .B +fail, +nofail
447 This option indicates that \fBnamed\fP \%<#\:std-iscman-named> should try [or not try] the next server if a SERVFAIL is received. The default is
448 to not try the next server, which is the reverse of normal stub
449 resolver behavior.
450 .UNINDENT
451 .INDENT 0.0
452 .TP
453 .B +fuzztime[=value], +nofuzztime
454 This option allows the signing time to be specified when generating
455 signed messages. If a value is specified it is the seconds since
456 00:00:00 January 1, 1970 UTC ignoring leap seconds. If no value
457 is specified 1646972129 (Fri 11 Mar 2022 04:15:29 UTC) is used.
458 The default is \fB+nofuzztime\fP and the current time is used.
459 .UNINDENT
460 .INDENT 0.0
461 .TP
462 .B +header\-only, +noheader\-only
463 This option sends a query with a DNS header without a question section. The
464 default is to add a question section. The query type and query name
465 are ignored when this is set.
466 .UNINDENT
467 .INDENT 0.0
468 .TP
469 .B +https[=value], +nohttps
470 This option indicates whether to use DNS over HTTPS (DoH) when querying
471 name servers. When this option is in use, the port number defaults to 443.
472 The HTTP POST request mode is used when sending the query.
473 .sp
474 If \fBvalue\fP is specified, it will be used as the HTTP endpoint in the
475 query URI; the default is \fB/dns\-query\fP\&. So, for example, \fBdig
476 @example.com +https\fP will use the URI \fBhttps://example.com/dns\-query\fP\&.
477 .UNINDENT
478 .INDENT 0.0
479 .TP
480 .B +https\-get[=value], +nohttps\-get
481 Similar to \fB+https\fP, except that the HTTP GET request mode is used
482 when sending the query.
483 .UNINDENT
484 .INDENT 0.0
485 .TP
486 .B +https\-post[=value], +nohttps\-post
487 Same as \fB+https\fP\&.
488 .UNINDENT
489 .INDENT 0.0
490 .TP
491 .B +http\-plain[=value], +nohttp\-plain
492 Similar to \fB+https\fP, except that HTTP queries will be sent over a
493 non\-encrypted channel. When this option is in use, the port number
494 defaults to 80 and the HTTP request mode is POST.
495 .UNINDENT
496 .INDENT 0.0
497 .TP
498 .B +http\-plain\-get[=value], +nohttp\-plain\-get
499 Similar to \fB+http\-plain\fP, except that the HTTP request mode is GET.
500 .UNINDENT
501 .INDENT 0.0
502 .TP
503 .B +http\-plain\-post[=value], +nohttp\-plain\-post
504 Same as \fB+http\-plain\fP\&.
505 .UNINDENT
506 .INDENT 0.0
507 .TP
508 .B +identify, +noidentify
509 This option shows [or does not show] the IP address and port number that
510 supplied the answer, when the \fB+short\fP option is enabled. If short
511 form answers are requested, the default is not to show the source
512 address and port number of the server that provided the answer.
513 .UNINDENT
514 .INDENT 0.0
515 .TP
516 .B +idn, +noidn
517 Enable or disable IDN processing. By default IDN is enabled for
518 input query names, and for display when the output is a terminal.
519 .sp
520 You can also turn off \fBdig\fP\(aqs IDN processing by setting
521 the \fBIDN_DISABLE\fP environment variable.
522 .UNINDENT
523 .INDENT 0.0
524 .TP
525 .B +ignore, +noignore
526 This option ignores [or does not ignore] truncation in UDP
527 responses instead of retrying with TCP. By default, TCP retries are
528 performed.
529 .UNINDENT
530 .INDENT 0.0
531 .TP
532 .B +keepalive, +nokeepalive
533 This option sends [or does not send] an EDNS Keepalive option.
534 .UNINDENT
535 .INDENT 0.0
536 .TP
537 .B +keepopen, +nokeepopen
538 This option keeps [or does not keep] the TCP socket open between queries, and reuses it rather than
539 creating a new TCP socket for each lookup. The default is
540 \fB+nokeepopen\fP\&.
541 .UNINDENT
542 .INDENT 0.0
543 .TP
544 .B +multiline, +nomultiline
545 This option prints [or does not print] records, like the SOA records, in a verbose multi\-line format
546 with human\-readable comments. The default is to print each record on
547 a single line to facilitate machine parsing of the \fBdig\fP output.
548 .UNINDENT
549 .INDENT 0.0
550 .TP
551 .B +ndots=D
552 This option sets the number of dots (\fBD\fP) that must appear in \fBname\fP for
553 it to be considered absolute. The default value is that defined using
554 the \fBndots\fP statement in \fB/etc/resolv.conf\fP, or 1 if no \fBndots\fP
555 statement is present. Names with fewer dots are interpreted as
556 relative names, and are searched for in the domains listed in the
557 \fBsearch\fP or \fBdomain\fP directive in \fB/etc/resolv.conf\fP if
558 \fB+search\fP is set.
559 .UNINDENT
560 .INDENT 0.0
561 .TP
562 .B +nsid, +nonsid
563 When enabled, this option includes an EDNS name server ID request when sending a query.
564 .UNINDENT
565 .INDENT 0.0
566 .TP
567 .B +nssearch, +nonssearch
568 When this option is set, \fBdig\fP attempts to find the authoritative
569 name servers for the zone containing the name being looked up, and
570 display the SOA record that each name server has for the zone.
571 Addresses of servers that did not respond are also printed.
572 .UNINDENT
573 .INDENT 0.0
574 .TP
575 .B +onesoa, +noonesoa
576 When enabled, this option prints only one (starting) SOA record when performing an AXFR. The
577 default is to print both the starting and ending SOA records.
578 .UNINDENT
579 .INDENT 0.0
580 .TP
581 .B +opcode=value, +noopcode
582 When enabled, this option sets (restores) the DNS message opcode to the specified value. The
583 default value is QUERY (0).
584 .UNINDENT
585 .INDENT 0.0
586 .TP
587 .B +padding=value
588 This option pads the size of the query packet using the EDNS Padding option to
589 blocks of \fBvalue\fP bytes. For example, \fB+padding=32\fP causes a
590 48\-byte query to be padded to 64 bytes. The default block size is 0,
591 which disables padding; the maximum is 512. Values are ordinarily
592 expected to be powers of two, such as 128; however, this is not
593 mandatory. Responses to padded queries may also be padded, but only
594 if the query uses TCP or DNS COOKIE.
595 .UNINDENT
596 .INDENT 0.0
597 .TP
598 .B +proxy[=src_addr[#src_port]\-dst_addr[#dst_port]], +noproxy
599 When this option is set, \fBdig\fP adds PROXYv2 headers to the
600 queries. When source and destination addresses are specified, the
601 headers contain them and use the \fBPROXY\fP command. It means for
602 the remote peer that the queries were sent on behalf of another
603 node and that the PROXYv2 header reflects the original connection
604 endpoints. The default source port is \fB0\fP and destination port is
605 \fI53\fP\&.
606 .sp
607 For encrypted DNS transports, to prevent accidental information
608 leakage, encryption is applied to the PROXYv2 headers: the headers
609 are sent right after the handshake process has been completed.
610 .sp
611 For plain DNS transports, no encryption is applied to the PROXYv2
612 headers.
613 .sp
614 If the addressees are omitted, PROXYv2 headers, that use the
615 \fBLOCAL\fP command set, are added instead. For the remote peer, that
616 means that the queries were sent on purpose without being relayed,
617 so the real connection endpoint addresses must be used.
618 .UNINDENT
619 .INDENT 0.0
620 .TP
621 .B +proxy\-plain[=src_addr[#src_port]\-dst_addr[#dst_port], +noproxy\-plain
622 The same as \fB+[no]proxy\fP, but instructs \fBdig\fP to send PROXYv2
623 headers ahead of any encryption, before any handshake messages are
624 sent. That makes \fBdig\fP behave exactly how it is described
625 in the PROXY protocol specification, but not all software expects
626 such behaviour.
627 .sp
628 Please consult the software documentation to find out if you need
629 this option. (for example, \fBdnsdist\fP expects encrypted PROXYv2
630 headers sent over TLS when encryption is used, while \fBHAProxy\fP
631 and many other software packages expect plain ones).
632 .sp
633 For plain DNS transports the option is effectively an alias for the
634 \fB+[no]proxy\fP described above.
635 .UNINDENT
636 .INDENT 0.0
637 .TP
638 .B +qid=value
639 This option specifies the query ID to use when sending queries.
640 .UNINDENT
641 .INDENT 0.0
642 .TP
643 .B +qr, +noqr
644 This option toggles the display of the query message as it is sent. By default, the query
645 is not printed.
646 .UNINDENT
647 .INDENT 0.0
648 .TP
649 .B +question, +noquestion
650 This option toggles the display of the question section of a query when an answer is
651 returned. The default is to print the question section as a comment.
652 .UNINDENT
653 .INDENT 0.0
654 .TP
655 .B +raflag, +noraflag
656 This option sets [or does not set] the RA (Recursion Available) bit in the query. The
657 default is \fB+noraflag\fP\&. This bit is ignored by the server for
658 QUERY.
659 .UNINDENT
660 .INDENT 0.0
661 .TP
662 .B +rdflag, +nordflag
663 This option is a synonym for \fB+recurse\fP, \fB+norecurse\fP\&.
664 .UNINDENT
665 .INDENT 0.0
666 .TP
667 .B +recurse, +norecurse
668 This option toggles the setting of the RD (recursion desired) bit in the query.
669 This bit is set by default, which means \fBdig\fP normally sends
670 recursive queries. Recursion is automatically disabled when the
671 \fB+nssearch\fP or \fB+trace\fP query option is used.
672 .UNINDENT
673 .INDENT 0.0
674 .TP
675 .B +retry=T
676 This option sets the number of times to retry UDP and TCP queries to server to \fBT\fP
677 instead of the default, 2. Unlike \fB+tries\fP, this does not include
678 the initial query.
679 .UNINDENT
680 .INDENT 0.0
681 .TP
682 .B +rrcomments, +norrcomments
683 This option toggles the display of per\-record comments in the output (for example,
684 human\-readable key information about DNSKEY records). The default is
685 not to print record comments unless multiline mode is active.
686 .UNINDENT
687 .INDENT 0.0
688 .TP
689 .B +search, +nosearch
690 This option uses [or does not use] the search list defined by the searchlist or domain
691 directive in \fBresolv.conf\fP, if any. The search list is not used by
692 default.
693 .sp
694 \fBndots\fP from \fBresolv.conf\fP (default 1), which may be overridden by
695 \fB+ndots\fP, determines whether the name is treated as relative
696 and hence whether a search is eventually performed.
697 .UNINDENT
698 .INDENT 0.0
699 .TP
700 .B +short, +noshort
701 This option toggles whether a terse answer is provided. The default is to print the answer in a verbose
702 form. This option always has a global effect; it cannot be set globally and
703 then overridden on a per\-lookup basis.
704 .UNINDENT
705 .INDENT 0.0
706 .TP
707 .B +showbadcookie, +noshowbadcookie
708 This option toggles whether to show the message containing the
709 BADCOOKIE rcode before retrying the request or not. The default
710 is to not show the messages.
711 .UNINDENT
712 .INDENT 0.0
713 .TP
714 .B +showbadvers, +noshowbadvers
715 This option toggles whether to show the message containing the
716 BADVERS rcode before retrying the request or not. The default
717 is to not show the messages.
718 .UNINDENT
719 .INDENT 0.0
720 .TP
721 .B +showsearch, +noshowsearch
722 This option performs [or does not perform] a search showing intermediate results.
723 .UNINDENT
724 .INDENT 0.0
725 .TP
726 .B +split=W
727 This option splits long hex\- or base64\-formatted fields in resource records into
728 chunks of \fBW\fP characters (where \fBW\fP is rounded up to the nearest
729 multiple of 4). \fB+nosplit\fP or \fB+split=0\fP causes fields not to be
730 split at all. The default is 56 characters, or 44 characters when
731 multiline mode is active.
732 .UNINDENT
733 .INDENT 0.0
734 .TP
735 .B +stats, +nostats
736 This option toggles the printing of statistics: when the query was made, the size of the
737 reply, etc. The default behavior is to print the query statistics as a
738 comment after each lookup.
739 .UNINDENT
740 .INDENT 0.0
741 .TP
742 .B +subnet=addr[/prefix\-length], +nosubnet
743 This option sends [or does not send] an EDNS CLIENT\-SUBNET option with the specified IP
744 address or network prefix.
745 .sp
746 \fBdig +subnet=0.0.0.0/0\fP, or simply \fBdig +subnet=0\fP for short,
747 sends an EDNS CLIENT\-SUBNET option with an empty address and a source
748 prefix\-length of zero, which signals a resolver that the client\(aqs
749 address information must \fInot\fP be used when resolving this query.
750 .UNINDENT
751 .INDENT 0.0
752 .TP
753 .B +tcflag, +notcflag
754 This option sets [or does not set] the TC (TrunCation) bit in the query. The default is
755 \fB+notcflag\fP\&. This bit is ignored by the server for QUERY.
756 .UNINDENT
757 .INDENT 0.0
758 .TP
759 .B +tcp, +notcp
760 This option indicates whether to use TCP when querying name
761 servers. The default behavior is to use UDP unless a type \fBany\fP
762 or \fBixfr=N\fP query is requested, in which case the default is
763 TCP. AXFR queries always use TCP. To prevent retry over TCP when
764 TC=1 is returned from a UDP query, use \fB+ignore\fP\&.
765 .UNINDENT
766 .INDENT 0.0
767 .TP
768 .B +timeout=T
769 This option sets the timeout for a query to \fBT\fP seconds. The default timeout is
770 5 seconds. An attempt to set \fBT\fP to less than 1 is silently set to 1.
771 .UNINDENT
772 .INDENT 0.0
773 .TP
774 .B +tls, +notls
775 This option indicates whether to use DNS over TLS (DoT) when querying
776 name servers. When this option is in use, the port number defaults
777 to 853.
778 .UNINDENT
779 .INDENT 0.0
780 .TP
781 .B +tls\-ca[=file\-name], +notls\-ca
782 This option enables remote server TLS certificate validation for
783 DNS transports, relying on TLS. Certificate authorities
784 certificates are loaded from the specified PEM file
785 (\fBfile\-name\fP). If the file is not specified, the default
786 certificates from the global certificates store are used.
787 .UNINDENT
788 .INDENT 0.0
789 .TP
790 .B +tls\-certfile=file\-name, +tls\-keyfile=file\-name, +notls\-certfile, +notls\-keyfile
791 These options set the state of certificate\-based client
792 authentication for DNS transports, relying on TLS. Both certificate
793 chain file and private key file are expected to be in PEM format.
794 Both options must be specified at the same time.
795 .UNINDENT
796 .INDENT 0.0
797 .TP
798 .B +tls\-hostname=hostname, +notls\-hostname
799 This option makes \fBdig\fP use the provided hostname during remote
800 server TLS certificate verification. Otherwise, the DNS server name
801 is used. This option has no effect if \fB+tls\-ca\fP is not specified.
802 .UNINDENT
803 .INDENT 0.0
804 .TP
805 .B +trace, +notrace
806 This option toggles tracing of the delegation path from the root name
807 servers for the name being looked up. Tracing is disabled by default.
808 When tracing is enabled, \fBdig\fP makes iterative queries to
809 resolve the name being looked up. It follows referrals from the root
810 servers, showing the answer from each server that was used to resolve
811 the lookup.
812 .sp
813 If \fB@server\fP is also specified, it affects only the initial query for
814 the root zone name servers.
815 .sp
816 \fB+dnssec\fP is set when \fB+trace\fP is set, to better
817 emulate the default queries from a name server.
818 .sp
819 Note that the \fBdelv +ns\fP option can also be used for tracing the
820 resolution of a name from the root (see \fBdelv\fP \%<#\:std-iscman-delv>).
821 .UNINDENT
822 .INDENT 0.0
823 .TP
824 .B +tries=T
825 This option sets the number of times to try UDP and TCP queries to server to \fBT\fP
826 instead of the default, 3. If \fBT\fP is less than or equal to zero,
827 the number of tries is silently rounded up to 1.
828 .UNINDENT
829 .INDENT 0.0
830 .TP
831 .B +ttlid, +nottlid
832 This option displays [or does not display] the TTL when printing the record.
833 .UNINDENT
834 .INDENT 0.0
835 .TP
836 .B +ttlunits, +nottlunits
837 This option displays [or does not display] the TTL in friendly human\-readable time
838 units of \fBs\fP, \fBm\fP, \fBh\fP, \fBd\fP, and \fBw\fP, representing seconds, minutes,
839 hours, days, and weeks. This implies \fB+ttlid\fP\&.
840 .UNINDENT
841 .INDENT 0.0
842 .TP
843 .B +unknownformat, +nounknownformat
844 This option prints all RDATA in unknown RR type presentation format (\fBRFC 3597\fP \%<https://\:datatracker\:.ietf\:.org/\:doc/\:html/\:rfc3597\:.html>).
845 The default is to print RDATA for known types in the type\(aqs
846 presentation format.
847 .UNINDENT
848 .INDENT 0.0
849 .TP
850 .B +vc, +novc
851 This option uses [or does not use] TCP when querying name servers. This alternate
852 syntax to \fB+tcp\fP is provided for backwards compatibility. The
853 \fBvc\fP stands for \(dqvirtual circuit.\(dq
854 .UNINDENT
855 .INDENT 0.0
856 .TP
857 .B +yaml, +noyaml
858 When enabled, this option prints the responses (and, if \fB+qr\fP is in use, also the
859 outgoing queries) in a detailed YAML format.
860 .UNINDENT
861 .INDENT 0.0
862 .TP
863 .B +zflag, +nozflag
864 This option sets [or does not set] the last unassigned DNS header flag in a DNS query.
865 This flag is off by default.
866 .UNINDENT
867 .SH MULTIPLE QUERIES
868 .sp
869 The BIND 9 implementation of \fBdig\fP supports specifying multiple
870 queries on the command line (in addition to supporting the \fB\-f\fP batch
871 file option). Each of those queries can be supplied with its own set of
872 flags, options, and query options.
873 .sp
874 In this case, each \fBquery\fP argument represents an individual query in
875 the command\-line syntax described above. Each consists of any of the
876 standard options and flags, the name to be looked up, an optional query
877 type and class, and any query options that should be applied to that
878 query.
879 .sp
880 A global set of query options, which should be applied to all queries,
881 can also be supplied. These global query options must precede the first
882 tuple of name, class, type, options, flags, and query options supplied
883 on the command line. Any global query options (except \fB+cmd\fP and
884 \fB+short\fP options) can be overridden by a query\-specific set of
885 query options. For example:
886 .INDENT 0.0
887 .INDENT 3.5
888 .sp
889 .EX
890 dig +qr www.isc.org any \-x 127.0.0.1 isc.org ns +noqr
891 .EE
892 .UNINDENT
893 .UNINDENT
894 .sp
895 shows how \fBdig\fP can be used from the command line to make three
896 lookups: an ANY query for \fBwww.isc.org\fP, a reverse lookup of 127.0.0.1,
897 and a query for the NS records of \fBisc.org\fP\&. A global query option of
898 \fB+qr\fP is applied, so that \fBdig\fP shows the initial query it made for
899 each lookup. The final query has a local query option of \fB+noqr\fP which
900 means that \fBdig\fP does not print the initial query when it looks up the
901 NS records for \fBisc.org\fP\&.
902 .SH RETURN CODES
903 .sp
904 \fBdig\fP return codes are:
905 .INDENT 0.0
906 .TP
907 .B \fB0\fP
908 DNS response received, including NXDOMAIN status
909 .TP
910 .B \fB1\fP
911 Usage error
912 .TP
913 .B \fB8\fP
914 Couldn\(aqt open batch file
915 .TP
916 .B \fB9\fP
917 No reply from server
918 .TP
919 .B \fB10\fP
920 Internal error
921 .UNINDENT
922 .SH FILES
923 .sp
924 \fB/etc/resolv.conf\fP
925 .sp
926 \fB${HOME}/.digrc\fP
927 .SH EXAMPLES
928 .sp
929 Only display the IP address(es) for example.com:
930 .INDENT 0.0
931 .INDENT 3.5
932 .sp
933 .EX
934 dig +short example.com
935 .EE
936 .UNINDENT
937 .UNINDENT
938 .sp
939 Query the nameserver f.gtld\-servers.net for example.com:
940 .INDENT 0.0
941 .INDENT 3.5
942 .sp
943 .EX
944 dig @f.gtld\-servers.net example.com
945 .EE
946 .UNINDENT
947 .UNINDENT
948 .sp
949 Look up the TXT record for example.com:
950 .INDENT 0.0
951 .INDENT 3.5
952 .sp
953 .EX
954 dig txt example.com
955 .EE
956 .UNINDENT
957 .UNINDENT
958 .sp
959 Look up the hostname for an IP with reverse DNS:
960 .INDENT 0.0
961 .INDENT 3.5
962 .sp
963 .EX
964 dig \-x 192.0.2.1
965 .EE
966 .UNINDENT
967 .UNINDENT
968 .sp
969 Display a much shorter output with just the name, record type, TTL, and value for each answer:
970 .INDENT 0.0
971 .INDENT 3.5
972 .sp
973 .EX
974 dig +noall +answer example.com
975 .EE
976 .UNINDENT
977 .UNINDENT
978 .SH SEE ALSO
979 .sp
980 \fBdelv(1)\fP \%<#\:std-iscman-delv>, \fBhost(1)\fP \%<#\:std-iscman-host>, \fBnamed(8)\fP \%<#\:std-iscman-named>, \fBdnssec\-keygen(8)\fP \%<#\:std-iscman-dnssec-keygen>, \fBRFC 1035\fP \%<https://\:datatracker\:.ietf\:.org/\:doc/\:html/\:rfc1035\:.html>\&.
981 .SH BUGS
982 .sp
983 There are probably too many query options.
984 .SH Author
985 Internet Systems Consortium
986 .SH Copyright
987 2026, Internet Systems Consortium
988 .\" End of generated man page.