xref: /netbsd-src/external/mpl/bind/dist/bin/dig/dig.rst (revision 32d1c65c71fbdb65a012e8392a62a757dd6853e9)
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:: +dscp=value
351
352   This option formerly set the DSCP value used when sending a query.
353   It is now obsolete, and has no effect.
354
355.. option:: +edns[=#], +noedns
356
357   This option specifies the EDNS version to query with. Valid values are 0 to 255.
358   Setting the EDNS version causes an EDNS query to be sent.
359   ``+noedns`` clears the remembered EDNS version. EDNS is set to 0 by
360   default.
361
362.. option:: +ednsflags[=#], +noednsflags
363
364   This option sets the must-be-zero EDNS flags bits (Z bits) to the specified value.
365   Decimal, hex, and octal encodings are accepted. Setting a named flag
366   (e.g., DO) is silently ignored. By default, no Z bits are set.
367
368.. option:: +ednsnegotiation, +noednsnegotiation
369
370   This option enables/disables EDNS version negotiation. By default, EDNS version
371   negotiation is enabled.
372
373.. option:: +ednsopt[=code[:value]], +noednsopt
374
375   This option specifies the EDNS option with code point ``code`` and an optional payload
376   of ``value`` as a hexadecimal string. ``code`` can be either an EDNS
377   option name (for example, ``NSID`` or ``ECS``) or an arbitrary
378   numeric value. ``+noednsopt`` clears the EDNS options to be sent.
379
380.. option:: +expire, +noexpire
381
382   This option sends an EDNS Expire option.
383
384.. option:: +fail, +nofail
385
386   This option indicates that :iscman:`named` should try [or not try] the next server if a SERVFAIL is received. The default is
387   to not try the next server, which is the reverse of normal stub
388   resolver behavior.
389
390.. option:: +fuzztime[=value], +nofuzztime
391
392   This option allows the signing time to be specified when generating
393   signed messages.  If a value is specified it is the seconds since
394   00:00:00 January 1, 1970 UTC ignoring leap seconds.  If no value
395   is specified 1646972129 (Fri 11 Mar 2022 04:15:29 UTC) is used.
396   The default is ``+nofuzztime`` and the current time is used.
397
398.. option:: +header-only, +noheader-only
399
400   This option sends a query with a DNS header without a question section. The
401   default is to add a question section. The query type and query name
402   are ignored when this is set.
403
404.. option:: +https[=value], +nohttps
405
406   This option indicates whether to use DNS over HTTPS (DoH) when querying
407   name servers.  When this option is in use, the port number defaults to 443.
408   The HTTP POST request mode is used when sending the query.
409
410   If ``value`` is specified, it will be used as the HTTP endpoint in the
411   query URI; the default is ``/dns-query``. So, for example, ``dig
412   @example.com +https`` will use the URI ``https://example.com/dns-query``.
413
414.. option:: +https-get[=value], +nohttps-get
415
416   Similar to :option:`+https`, except that the HTTP GET request mode is used
417   when sending the query.
418
419.. option:: +https-post[=value], +nohttps-post
420
421   Same as :option:`+https`.
422
423.. option:: +http-plain[=value], +nohttp-plain
424
425   Similar to :option:`+https`, except that HTTP queries will be sent over a
426   non-encrypted channel. When this option is in use, the port number
427   defaults to 80 and the HTTP request mode is POST.
428
429.. option:: +http-plain-get[=value], +nohttp-plain-get
430
431   Similar to :option:`+http-plain`, except that the HTTP request mode is GET.
432
433.. option:: +http-plain-post[=value], +nohttp-plain-post
434
435   Same as :option:`+http-plain`.
436
437.. option:: +identify, +noidentify
438
439   This option shows [or does not show] the IP address and port number that
440   supplied the answer, when the :option:`+short` option is enabled. If short
441   form answers are requested, the default is not to show the source
442   address and port number of the server that provided the answer.
443
444.. option:: +idnin, +noidnin
445
446   This option processes [or does not process] IDN domain names on input. This requires
447   ``IDN SUPPORT`` to have been enabled at compile time.
448
449   The default is to process IDN input when standard output is a tty.
450   The IDN processing on input is disabled when :program:`dig` output is redirected
451   to files, pipes, and other non-tty file descriptors.
452
453.. option:: +idnout, +noidnout
454
455   This option converts [or does not convert] puny code on output. This requires
456   ``IDN SUPPORT`` to have been enabled at compile time.
457
458   The default is to process puny code on output when standard output is
459   a tty. The puny code processing on output is disabled when :program:`dig` output
460   is redirected to files, pipes, and other non-tty file descriptors.
461
462.. option:: +ignore, +noignore
463
464   This option ignores [or does not ignore] truncation in UDP responses instead of retrying with TCP. By
465   default, TCP retries are performed.
466
467.. option:: +keepalive, +nokeepalive
468
469   This option sends [or does not send] an EDNS Keepalive option.
470
471.. option:: +keepopen, +nokeepopen
472
473   This option keeps [or does not keep] the TCP socket open between queries, and reuses it rather than
474   creating a new TCP socket for each lookup. The default is
475   ``+nokeepopen``.
476
477.. option:: +multiline, +nomultiline
478
479   This option prints [or does not print] records, like the SOA records, in a verbose multi-line format
480   with human-readable comments. The default is to print each record on
481   a single line to facilitate machine parsing of the :program:`dig` output.
482
483.. option:: +ndots=D
484
485   This option sets the number of dots (``D``) that must appear in ``name`` for
486   it to be considered absolute. The default value is that defined using
487   the ``ndots`` statement in ``/etc/resolv.conf``, or 1 if no ``ndots``
488   statement is present. Names with fewer dots are interpreted as
489   relative names, and are searched for in the domains listed in the
490   ``search`` or ``domain`` directive in ``/etc/resolv.conf`` if
491   :option:`+search` is set.
492
493.. option:: +nsid, +nonsid
494
495   When enabled, this option includes an EDNS name server ID request when sending a query.
496
497.. option:: +nssearch, +nonssearch
498
499   When this option is set, :program:`dig` attempts to find the authoritative
500   name servers for the zone containing the name being looked up, and
501   display the SOA record that each name server has for the zone.
502   Addresses of servers that did not respond are also printed.
503
504.. option:: +onesoa, +noonesoa
505
506   When enabled, this option prints only one (starting) SOA record when performing an AXFR. The
507   default is to print both the starting and ending SOA records.
508
509.. option:: +opcode=value, +noopcode
510
511   When enabled, this option sets (restores) the DNS message opcode to the specified value. The
512   default value is QUERY (0).
513
514.. option:: +padding=value
515
516   This option pads the size of the query packet using the EDNS Padding option to
517   blocks of ``value`` bytes. For example, ``+padding=32`` causes a
518   48-byte query to be padded to 64 bytes. The default block size is 0,
519   which disables padding; the maximum is 512. Values are ordinarily
520   expected to be powers of two, such as 128; however, this is not
521   mandatory. Responses to padded queries may also be padded, but only
522   if the query uses TCP or DNS COOKIE.
523
524.. option:: +qid=value
525
526   This option specifies the query ID to use when sending queries.
527
528.. option:: +qr, +noqr
529
530   This option toggles the display of the query message as it is sent. By default, the query
531   is not printed.
532
533.. option:: +question, +noquestion
534
535   This option toggles the display of the question section of a query when an answer is
536   returned. The default is to print the question section as a comment.
537
538.. option:: +raflag, +noraflag
539
540   This option sets [or does not set] the RA (Recursion Available) bit in the query. The
541   default is ``+noraflag``. This bit is ignored by the server for
542   QUERY.
543
544.. option:: +rdflag, +nordflag
545
546   This option is a synonym for :option:`+recurse`, :option:`+norecurse`.
547
548.. option:: +recurse, +norecurse
549
550   This option toggles the setting of the RD (recursion desired) bit in the query.
551   This bit is set by default, which means :program:`dig` normally sends
552   recursive queries. Recursion is automatically disabled when the
553   :option:`+nssearch` or :option:`+trace` query option is used.
554
555.. option:: +retry=T
556
557   This option sets the number of times to retry UDP and TCP queries to server to ``T``
558   instead of the default, 2.  Unlike :option:`+tries`, this does not include
559   the initial query.
560
561.. option:: +rrcomments, +norrcomments
562
563   This option toggles the display of per-record comments in the output (for example,
564   human-readable key information about DNSKEY records). The default is
565   not to print record comments unless multiline mode is active.
566
567.. option:: +search, +nosearch
568
569   This option uses [or does not use] the search list defined by the searchlist or domain
570   directive in ``resolv.conf``, if any. The search list is not used by
571   default.
572
573   ``ndots`` from ``resolv.conf`` (default 1), which may be overridden by
574   :option:`+ndots`, determines whether the name is treated as relative
575   and hence whether a search is eventually performed.
576
577.. option:: +short, +noshort
578
579   This option toggles whether a terse answer is provided. The default is to print the answer in a verbose
580   form. This option always has a global effect; it cannot be set globally and
581   then overridden on a per-lookup basis.
582
583.. option:: +showbadcookie, +noshowbadcookie
584
585   This option toggles whether to show the message containing the
586   BADCOOKIE rcode before retrying the request or not. The default
587   is to not show the messages.
588
589.. option:: +showsearch, +noshowsearch
590
591   This option performs [or does not perform] a search showing intermediate results.
592
593.. option:: +sigchase, +nosigchase
594
595   This feature is now obsolete and has been removed; use :iscman:`delv`
596   instead.
597
598.. option:: +split=W
599
600   This option splits long hex- or base64-formatted fields in resource records into
601   chunks of ``W`` characters (where ``W`` is rounded up to the nearest
602   multiple of 4). ``+nosplit`` or ``+split=0`` causes fields not to be
603   split at all. The default is 56 characters, or 44 characters when
604   multiline mode is active.
605
606.. option:: +stats, +nostats
607
608   This option toggles the printing of statistics: when the query was made, the size of the
609   reply, etc. The default behavior is to print the query statistics as a
610   comment after each lookup.
611
612.. option:: +subnet=addr[/prefix-length], +nosubnet
613
614   This option sends [or does not send] an EDNS CLIENT-SUBNET option with the specified IP
615   address or network prefix.
616
617   ``dig +subnet=0.0.0.0/0``, or simply ``dig +subnet=0`` for short,
618   sends an EDNS CLIENT-SUBNET option with an empty address and a source
619   prefix-length of zero, which signals a resolver that the client's
620   address information must *not* be used when resolving this query.
621
622.. option:: +tcflag, +notcflag
623
624   This option sets [or does not set] the TC (TrunCation) bit in the query. The default is
625   ``+notcflag``. This bit is ignored by the server for QUERY.
626
627.. option:: +tcp, +notcp
628
629   This option indicates whether to use TCP when querying name
630   servers.  The default behavior is to use UDP unless a type ``any``
631   or ``ixfr=N`` query is requested, in which case the default is
632   TCP. AXFR queries always use TCP. To prevent retry over TCP when
633   TC=1 is returned from a UDP query, use ``+ignore``.
634
635.. option:: +timeout=T
636
637   This option sets the timeout for a query to ``T`` seconds. The default timeout is
638   5 seconds. An attempt to set ``T`` to less than 1 is silently set to 1.
639
640.. option:: +tls, +notls
641
642   This option indicates whether to use DNS over TLS (DoT) when querying
643   name servers. When this option is in use, the port number defaults
644   to 853.
645
646.. option:: +tls-ca[=file-name], +notls-ca
647
648   This option enables remote server TLS certificate validation for
649   DNS transports, relying on TLS. Certificate authorities
650   certificates are loaded from the specified PEM file
651   (``file-name``). If the file is not specified, the default
652   certificates from the global certificates store are used.
653
654.. option:: +tls-certfile=file-name, +tls-keyfile=file-name, +notls-certfile, +notls-keyfile
655
656   These options set the state of certificate-based client
657   authentication for DNS transports, relying on TLS. Both certificate
658   chain file and private key file are expected to be in PEM format.
659   Both options must be specified at the same time.
660
661.. option:: +tls-hostname=hostname, +notls-hostname
662
663   This option makes :program:`dig` use the provided hostname during remote
664   server TLS certificate verification. Otherwise, the DNS server name
665   is used. This option has no effect if :option:`+tls-ca` is not specified.
666
667.. option:: +topdown, +notopdown
668
669   This feature is related to :option:`dig +sigchase`, which is obsolete and
670   has been removed. Use :iscman:`delv` instead.
671
672.. option:: +trace, +notrace
673
674   This option toggles tracing of the delegation path from the root name servers for
675   the name being looked up. Tracing is disabled by default. When
676   tracing is enabled, :program:`dig` makes iterative queries to resolve the
677   name being looked up. It follows referrals from the root servers,
678   showing the answer from each server that was used to resolve the
679   lookup.
680
681   If ``@server`` is also specified, it affects only the initial query for
682   the root zone name servers.
683
684   :option:`+dnssec` is also set when :option:`+trace` is set, to better emulate the
685   default queries from a name server.
686
687.. option:: +tries=T
688
689   This option sets the number of times to try UDP and TCP queries to server to ``T``
690   instead of the default, 3. If ``T`` is less than or equal to zero,
691   the number of tries is silently rounded up to 1.
692
693.. option:: +trusted-key=####
694
695   This option formerly specified trusted keys for use with :option:`dig +sigchase`. This
696   feature is now obsolete and has been removed; use :iscman:`delv` instead.
697
698.. option:: +ttlid, +nottlid
699
700   This option displays [or does not display] the TTL when printing the record.
701
702.. option:: +ttlunits, +nottlunits
703
704   This option displays [or does not display] the TTL in friendly human-readable time
705   units of ``s``, ``m``, ``h``, ``d``, and ``w``, representing seconds, minutes,
706   hours, days, and weeks. This implies :option:`+ttlid`.
707
708.. option:: +unknownformat, +nounknownformat
709
710   This option prints all RDATA in unknown RR type presentation format (:rfc:`3597`).
711   The default is to print RDATA for known types in the type's
712   presentation format.
713
714.. option:: +vc, +novc
715
716   This option uses [or does not use] TCP when querying name servers. This alternate
717   syntax to :option:`+tcp` is provided for backwards compatibility. The
718   ``vc`` stands for "virtual circuit."
719
720.. option:: +yaml, +noyaml
721
722   When enabled, this option prints the responses (and, if :option:`+qr` is in use, also the
723   outgoing queries) in a detailed YAML format.
724
725.. option:: +zflag, +nozflag
726
727   This option sets [or does not set] the last unassigned DNS header flag in a DNS query.
728   This flag is off by default.
729
730Multiple Queries
731~~~~~~~~~~~~~~~~
732
733The BIND 9 implementation of :program:`dig` supports specifying multiple
734queries on the command line (in addition to supporting the :option:`-f` batch
735file option). Each of those queries can be supplied with its own set of
736flags, options, and query options.
737
738In this case, each ``query`` argument represents an individual query in
739the command-line syntax described above. Each consists of any of the
740standard options and flags, the name to be looked up, an optional query
741type and class, and any query options that should be applied to that
742query.
743
744A global set of query options, which should be applied to all queries,
745can also be supplied. These global query options must precede the first
746tuple of name, class, type, options, flags, and query options supplied
747on the command line. Any global query options (except :option:`+cmd` and
748:option:`+short` options) can be overridden by a query-specific set of
749query options. For example:
750
751::
752
753   dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
754
755shows how :program:`dig` can be used from the command line to make three
756lookups: an ANY query for ``www.isc.org``, a reverse lookup of 127.0.0.1,
757and a query for the NS records of ``isc.org``. A global query option of
758:option:`+qr` is applied, so that :program:`dig` shows the initial query it made for
759each lookup. The final query has a local query option of :option:`+noqr` which
760means that :program:`dig` does not print the initial query when it looks up the
761NS records for ``isc.org``.
762
763IDN Support
764~~~~~~~~~~~
765
766If :program:`dig` has been built with IDN (internationalized domain name)
767support, it can accept and display non-ASCII domain names. :program:`dig`
768appropriately converts character encoding of a domain name before sending
769a request to a DNS server or displaying a reply from the server.
770To turn off IDN support, use the parameters
771:option:`+idnin` and :option:`+idnout`, or define the ``IDN_DISABLE`` environment
772variable.
773
774Return Codes
775~~~~~~~~~~~~
776
777:program:`dig` return codes are:
778
779``0``
780   DNS response received, including NXDOMAIN status
781
782``1``
783   Usage error
784
785``8``
786   Couldn't open batch file
787
788``9``
789   No reply from server
790
791``10``
792   Internal error
793
794Files
795~~~~~
796
797``/etc/resolv.conf``
798
799``${HOME}/.digrc``
800
801See Also
802~~~~~~~~
803
804:iscman:`delv(1) <delv>`, :iscman:`host(1) <host>`, :iscman:`named(8) <named>`, :iscman:`dnssec-keygen(8) <dnssec-keygen>`, :rfc:`1035`.
805
806Bugs
807~~~~
808
809There are probably too many query options.
810