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