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 18 dig - DNS lookup utility 19 ------------------------ 20 21 Synopsis 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 29 Description 30 ~~~~~~~~~~~ 31 32 :program:`dig` is a flexible tool for interrogating DNS name servers. It 33 performs DNS lookups and displays the answers that are returned from the 34 name server(s) that were queried. Most DNS administrators use :program:`dig` to 35 troubleshoot DNS problems because of its flexibility, ease of use, and 36 clarity of output. Other lookup tools tend to have less functionality 37 than :program:`dig`. 38 39 Although :program:`dig` is normally used with command-line arguments, it also 40 has a batch mode of operation for reading lookup requests from a file. A 41 brief summary of its command-line arguments and options is printed when 42 the :option:`-h` option is given. The BIND 9 43 implementation of :program:`dig` allows multiple lookups to be issued from the 44 command line. 45 46 Unless it is told to query a specific name server, :program:`dig` tries each 47 of the servers listed in ``/etc/resolv.conf``. If no usable server 48 addresses are found, :program:`dig` sends the query to the local host. 49 50 When no command-line arguments or options are given, :program:`dig` 51 performs an NS query for "." (the root). 52 53 It 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 55 before the command-line arguments. The :option:`-r` option disables this 56 feature, for scripts that need predictable behavior. 57 58 The IN and CH class names overlap with the IN and CH top-level domain 59 names. Either use the :option:`-t` and :option:`-c` options to specify the type and 60 class, use the :option:`-q` to specify the domain name, or use "IN." and 61 "CH." when looking up these top-level domains. 62 63 Simple Usage 64 ~~~~~~~~~~~~ 65 66 A typical invocation of :program:`dig` looks like: 67 68 :: 69 70 dig @server name type 71 72 where: 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 100 Options 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 215 Query Options 216 ~~~~~~~~~~~~~ 217 218 :program:`dig` provides a number of query options which affect the way in which 219 lookups are made and the results displayed. Some of these set or reset 220 flag bits in the query header, some determine which sections of the 221 answer get printed, and others determine the timeout and retry 222 strategies. 223 224 Each 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 226 the string ``no`` to negate the meaning of that keyword. Other keywords 227 assign values to options, like the timeout interval. They have the form 228 ``+keyword=value``. Keywords may be abbreviated, provided the 229 abbreviation 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:: +coflag, +co, +nocoflag, +noco 302 303 This option sets [or does not set] the CO (Compact denial of 304 existence Ok) EDNS bit in the query. If set, it tells servers 305 that Compact Denial of Existence responses are acceptable when 306 replying to queries. The default is ``+nocoflag``. 307 308 .. option:: +comments, +nocomments 309 310 This option toggles the display of some comment lines in the output, with 311 information about the packet header and OPT pseudosection, and the names of 312 the response section. The default is to print these comments. 313 314 Other types of comments in the output are not affected by this option, but 315 can be controlled using other command-line switches. These include 316 :option:`+cmd`, :option:`+question`, :option:`+stats`, and :option:`+rrcomments`. 317 318 .. option:: +cookie=####, +nocookie 319 320 This option sends [or does not send] a COOKIE EDNS option, with an optional value. Replaying a COOKIE 321 from a previous response allows the server to identify a previous 322 client. The default is ``+cookie``. 323 324 ``+cookie`` is also set when :option:`+trace` is set to better emulate the 325 default queries from a nameserver. 326 327 .. option:: +crypto, +nocrypto 328 329 This option toggles the display of cryptographic fields in DNSSEC records. The 330 contents of these fields are unnecessary for debugging most DNSSEC 331 validation failures and removing them makes it easier to see the 332 common failures. The default is to display the fields. When omitted, 333 they are replaced by the string ``[omitted]`` or, in the DNSKEY case, the 334 key ID is displayed as the replacement, e.g. ``[ key id = value ]``. 335 336 .. option:: +defname, +nodefname 337 338 This option, which is deprecated, is treated as a synonym for 339 :option:`+search`, :option:`+nosearch`. 340 341 .. option:: +dns64prefix, +nodns64prefix 342 343 Lookup IPV4ONLY.ARPA AAAA and print any DNS64 prefixes found. 344 345 .. option:: +dnssec, +do, +nodnssec, +nodo 346 347 This option requests that DNSSEC records be sent by setting the DNSSEC OK (DO) bit in 348 the OPT record in the additional section of the query. 349 350 .. option:: +domain=somename 351 352 This option sets the search list to contain the single domain ``somename``, as if 353 specified in a ``domain`` directive in ``/etc/resolv.conf``, and 354 enables search list processing as if the :option:`+search` option were 355 given. 356 357 .. option:: +edns[=#], +noedns 358 359 This option specifies the EDNS version to query with. Valid values are 0 to 255. 360 Setting the EDNS version causes an EDNS query to be sent. 361 ``+noedns`` clears the remembered EDNS version. EDNS is set to 0 by 362 default. 363 364 .. option:: +ednsflags[=#], +noednsflags 365 366 This option sets the must-be-zero EDNS flags bits (Z bits) to the specified value. 367 Decimal, hex, and octal encodings are accepted. Setting a named flag 368 (e.g. DO, CO) is silently ignored. By default, no Z bits are set. 369 370 .. option:: +ednsnegotiation, +noednsnegotiation 371 372 This option enables/disables EDNS version negotiation. By default, EDNS version 373 negotiation is enabled. 374 375 .. option:: +ednsopt[=code[:value]], +noednsopt 376 377 This option specifies the EDNS option with code point ``code`` and an optional payload 378 of ``value`` as a hexadecimal string. ``code`` can be either an EDNS 379 option name (for example, ``NSID`` or ``ECS``) or an arbitrary 380 numeric value. ``+noednsopt`` clears the EDNS options to be sent. 381 382 .. option:: +expire, +noexpire 383 384 This option sends an EDNS Expire option. 385 386 .. option:: +fail, +nofail 387 388 This option indicates that :iscman:`named` should try [or not try] the next server if a SERVFAIL is received. The default is 389 to not try the next server, which is the reverse of normal stub 390 resolver behavior. 391 392 .. option:: +fuzztime[=value], +nofuzztime 393 394 This option allows the signing time to be specified when generating 395 signed messages. If a value is specified it is the seconds since 396 00:00:00 January 1, 1970 UTC ignoring leap seconds. If no value 397 is specified 1646972129 (Fri 11 Mar 2022 04:15:29 UTC) is used. 398 The default is ``+nofuzztime`` and the current time is used. 399 400 .. option:: +header-only, +noheader-only 401 402 This option sends a query with a DNS header without a question section. The 403 default is to add a question section. The query type and query name 404 are ignored when this is set. 405 406 .. option:: +https[=value], +nohttps 407 408 This option indicates whether to use DNS over HTTPS (DoH) when querying 409 name servers. When this option is in use, the port number defaults to 443. 410 The HTTP POST request mode is used when sending the query. 411 412 If ``value`` is specified, it will be used as the HTTP endpoint in the 413 query URI; the default is ``/dns-query``. So, for example, ``dig 414 @example.com +https`` will use the URI ``https://example.com/dns-query``. 415 416 .. option:: +https-get[=value], +nohttps-get 417 418 Similar to :option:`+https`, except that the HTTP GET request mode is used 419 when sending the query. 420 421 .. option:: +https-post[=value], +nohttps-post 422 423 Same as :option:`+https`. 424 425 .. option:: +http-plain[=value], +nohttp-plain 426 427 Similar to :option:`+https`, except that HTTP queries will be sent over a 428 non-encrypted channel. When this option is in use, the port number 429 defaults to 80 and the HTTP request mode is POST. 430 431 .. option:: +http-plain-get[=value], +nohttp-plain-get 432 433 Similar to :option:`+http-plain`, except that the HTTP request mode is GET. 434 435 .. option:: +http-plain-post[=value], +nohttp-plain-post 436 437 Same as :option:`+http-plain`. 438 439 .. option:: +identify, +noidentify 440 441 This option shows [or does not show] the IP address and port number that 442 supplied the answer, when the :option:`+short` option is enabled. If short 443 form answers are requested, the default is not to show the source 444 address and port number of the server that provided the answer. 445 446 .. option:: +idn, +noidn 447 448 Enable or disable IDN processing. By default IDN is enabled for 449 input query names, and for display when the output is a terminal. 450 451 You can also turn off :program:`dig`'s IDN processing by setting 452 the ``IDN_DISABLE`` environment variable. 453 454 .. option:: +ignore, +noignore 455 456 This option ignores [or does not ignore] truncation in UDP 457 responses instead of retrying with TCP. By default, TCP retries are 458 performed. 459 460 .. option:: +keepalive, +nokeepalive 461 462 This option sends [or does not send] an EDNS Keepalive option. 463 464 .. option:: +keepopen, +nokeepopen 465 466 This option keeps [or does not keep] the TCP socket open between queries, and reuses it rather than 467 creating a new TCP socket for each lookup. The default is 468 ``+nokeepopen``. 469 470 .. option:: +multiline, +nomultiline 471 472 This option prints [or does not print] records, like the SOA records, in a verbose multi-line format 473 with human-readable comments. The default is to print each record on 474 a single line to facilitate machine parsing of the :program:`dig` output. 475 476 .. option:: +ndots=D 477 478 This option sets the number of dots (``D``) that must appear in ``name`` for 479 it to be considered absolute. The default value is that defined using 480 the ``ndots`` statement in ``/etc/resolv.conf``, or 1 if no ``ndots`` 481 statement is present. Names with fewer dots are interpreted as 482 relative names, and are searched for in the domains listed in the 483 ``search`` or ``domain`` directive in ``/etc/resolv.conf`` if 484 :option:`+search` is set. 485 486 .. option:: +nsid, +nonsid 487 488 When enabled, this option includes an EDNS name server ID request when sending a query. 489 490 .. option:: +nssearch, +nonssearch 491 492 When this option is set, :program:`dig` attempts to find the authoritative 493 name servers for the zone containing the name being looked up, and 494 display the SOA record that each name server has for the zone. 495 Addresses of servers that did not respond are also printed. 496 497 .. option:: +onesoa, +noonesoa 498 499 When enabled, this option prints only one (starting) SOA record when performing an AXFR. The 500 default is to print both the starting and ending SOA records. 501 502 .. option:: +opcode=value, +noopcode 503 504 When enabled, this option sets (restores) the DNS message opcode to the specified value. The 505 default value is QUERY (0). 506 507 .. option:: +padding=value 508 509 This option pads the size of the query packet using the EDNS Padding option to 510 blocks of ``value`` bytes. For example, ``+padding=32`` causes a 511 48-byte query to be padded to 64 bytes. The default block size is 0, 512 which disables padding; the maximum is 512. Values are ordinarily 513 expected to be powers of two, such as 128; however, this is not 514 mandatory. Responses to padded queries may also be padded, but only 515 if the query uses TCP or DNS COOKIE. 516 517 .. option:: +proxy[=src_addr[#src_port]-dst_addr[#dst_port]], +noproxy 518 519 When this option is set, :program:`dig` adds PROXYv2 headers to the 520 queries. When source and destination addresses are specified, the 521 headers contain them and use the ``PROXY`` command. It means for 522 the remote peer that the queries were sent on behalf of another 523 node and that the PROXYv2 header reflects the original connection 524 endpoints. The default source port is ``0`` and destination port is 525 `53`. 526 527 For encrypted DNS transports, to prevent accidental information 528 leakage, encryption is applied to the PROXYv2 headers: the headers 529 are sent right after the handshake process has been completed. 530 531 For plain DNS transports, no encryption is applied to the PROXYv2 532 headers. 533 534 If the addressees are omitted, PROXYv2 headers, that use the 535 ``LOCAL`` command set, are added instead. For the remote peer, that 536 means that the queries were sent on purpose without being relayed, 537 so the real connection endpoint addresses must be used. 538 539 .. option:: +proxy-plain[=src_addr[#src_port]-dst_addr[#dst_port], +noproxy-plain 540 541 The same as ``+[no]proxy``, but instructs ``dig`` to send PROXYv2 542 headers ahead of any encryption, before any handshake messages are 543 sent. That makes :program:`dig` behave exactly how it is described 544 in the PROXY protocol specification, but not all software expects 545 such behaviour. 546 547 Please consult the software documentation to find out if you need 548 this option. (for example, ``dnsdist`` expects encrypted PROXYv2 549 headers sent over TLS when encryption is used, while ``HAProxy`` 550 and many other software packages expect plain ones). 551 552 For plain DNS transports the option is effectively an alias for the 553 ``+[no]proxy`` described above. 554 555 .. option:: +qid=value 556 557 This option specifies the query ID to use when sending queries. 558 559 .. option:: +qr, +noqr 560 561 This option toggles the display of the query message as it is sent. By default, the query 562 is not printed. 563 564 .. option:: +question, +noquestion 565 566 This option toggles the display of the question section of a query when an answer is 567 returned. The default is to print the question section as a comment. 568 569 .. option:: +raflag, +noraflag 570 571 This option sets [or does not set] the RA (Recursion Available) bit in the query. The 572 default is ``+noraflag``. This bit is ignored by the server for 573 QUERY. 574 575 .. option:: +rdflag, +nordflag 576 577 This option is a synonym for :option:`+recurse`, :option:`+norecurse`. 578 579 .. option:: +recurse, +norecurse 580 581 This option toggles the setting of the RD (recursion desired) bit in the query. 582 This bit is set by default, which means :program:`dig` normally sends 583 recursive queries. Recursion is automatically disabled when the 584 :option:`+nssearch` or :option:`+trace` query option is used. 585 586 .. option:: +retry=T 587 588 This option sets the number of times to retry UDP and TCP queries to server to ``T`` 589 instead of the default, 2. Unlike :option:`+tries`, this does not include 590 the initial query. 591 592 .. option:: +rrcomments, +norrcomments 593 594 This option toggles the display of per-record comments in the output (for example, 595 human-readable key information about DNSKEY records). The default is 596 not to print record comments unless multiline mode is active. 597 598 .. option:: +search, +nosearch 599 600 This option uses [or does not use] the search list defined by the searchlist or domain 601 directive in ``resolv.conf``, if any. The search list is not used by 602 default. 603 604 ``ndots`` from ``resolv.conf`` (default 1), which may be overridden by 605 :option:`+ndots`, determines whether the name is treated as relative 606 and hence whether a search is eventually performed. 607 608 .. option:: +short, +noshort 609 610 This option toggles whether a terse answer is provided. The default is to print the answer in a verbose 611 form. This option always has a global effect; it cannot be set globally and 612 then overridden on a per-lookup basis. 613 614 .. option:: +showbadcookie, +noshowbadcookie 615 616 This option toggles whether to show the message containing the 617 BADCOOKIE rcode before retrying the request or not. The default 618 is to not show the messages. 619 620 .. option:: +showbadvers, +noshowbadvers 621 622 This option toggles whether to show the message containing the 623 BADVERS rcode before retrying the request or not. The default 624 is to not show the messages. 625 626 .. option:: +showsearch, +noshowsearch 627 628 This option performs [or does not perform] a search showing intermediate results. 629 630 .. option:: +split=W 631 632 This option splits long hex- or base64-formatted fields in resource records into 633 chunks of ``W`` characters (where ``W`` is rounded up to the nearest 634 multiple of 4). ``+nosplit`` or ``+split=0`` causes fields not to be 635 split at all. The default is 56 characters, or 44 characters when 636 multiline mode is active. 637 638 .. option:: +stats, +nostats 639 640 This option toggles the printing of statistics: when the query was made, the size of the 641 reply, etc. The default behavior is to print the query statistics as a 642 comment after each lookup. 643 644 .. option:: +subnet=addr[/prefix-length], +nosubnet 645 646 This option sends [or does not send] an EDNS CLIENT-SUBNET option with the specified IP 647 address or network prefix. 648 649 ``dig +subnet=0.0.0.0/0``, or simply ``dig +subnet=0`` for short, 650 sends an EDNS CLIENT-SUBNET option with an empty address and a source 651 prefix-length of zero, which signals a resolver that the client's 652 address information must *not* be used when resolving this query. 653 654 .. option:: +tcflag, +notcflag 655 656 This option sets [or does not set] the TC (TrunCation) bit in the query. The default is 657 ``+notcflag``. This bit is ignored by the server for QUERY. 658 659 .. option:: +tcp, +notcp 660 661 This option indicates whether to use TCP when querying name 662 servers. The default behavior is to use UDP unless a type ``any`` 663 or ``ixfr=N`` query is requested, in which case the default is 664 TCP. AXFR queries always use TCP. To prevent retry over TCP when 665 TC=1 is returned from a UDP query, use ``+ignore``. 666 667 .. option:: +timeout=T 668 669 This option sets the timeout for a query to ``T`` seconds. The default timeout is 670 5 seconds. An attempt to set ``T`` to less than 1 is silently set to 1. 671 672 .. option:: +tls, +notls 673 674 This option indicates whether to use DNS over TLS (DoT) when querying 675 name servers. When this option is in use, the port number defaults 676 to 853. 677 678 .. option:: +tls-ca[=file-name], +notls-ca 679 680 This option enables remote server TLS certificate validation for 681 DNS transports, relying on TLS. Certificate authorities 682 certificates are loaded from the specified PEM file 683 (``file-name``). If the file is not specified, the default 684 certificates from the global certificates store are used. 685 686 .. option:: +tls-certfile=file-name, +tls-keyfile=file-name, +notls-certfile, +notls-keyfile 687 688 These options set the state of certificate-based client 689 authentication for DNS transports, relying on TLS. Both certificate 690 chain file and private key file are expected to be in PEM format. 691 Both options must be specified at the same time. 692 693 .. option:: +tls-hostname=hostname, +notls-hostname 694 695 This option makes :program:`dig` use the provided hostname during remote 696 server TLS certificate verification. Otherwise, the DNS server name 697 is used. This option has no effect if :option:`+tls-ca` is not specified. 698 699 .. option:: +trace, +notrace 700 701 This option toggles tracing of the delegation path from the root name 702 servers for the name being looked up. Tracing is disabled by default. 703 When tracing is enabled, :program:`dig` makes iterative queries to 704 resolve the name being looked up. It follows referrals from the root 705 servers, showing the answer from each server that was used to resolve 706 the lookup. 707 708 If ``@server`` is also specified, it affects only the initial query for 709 the root zone name servers. 710 711 :option:`+dnssec` is set when :option:`+trace` is set, to better 712 emulate the default queries from a name server. 713 714 Note that the ``delv +ns`` option can also be used for tracing the 715 resolution of a name from the root (see :iscman:`delv`). 716 717 .. option:: +tries=T 718 719 This option sets the number of times to try UDP and TCP queries to server to ``T`` 720 instead of the default, 3. If ``T`` is less than or equal to zero, 721 the number of tries is silently rounded up to 1. 722 723 .. option:: +ttlid, +nottlid 724 725 This option displays [or does not display] the TTL when printing the record. 726 727 .. option:: +ttlunits, +nottlunits 728 729 This option displays [or does not display] the TTL in friendly human-readable time 730 units of ``s``, ``m``, ``h``, ``d``, and ``w``, representing seconds, minutes, 731 hours, days, and weeks. This implies :option:`+ttlid`. 732 733 .. option:: +unknownformat, +nounknownformat 734 735 This option prints all RDATA in unknown RR type presentation format (:rfc:`3597`). 736 The default is to print RDATA for known types in the type's 737 presentation format. 738 739 .. option:: +vc, +novc 740 741 This option uses [or does not use] TCP when querying name servers. This alternate 742 syntax to :option:`+tcp` is provided for backwards compatibility. The 743 ``vc`` stands for "virtual circuit." 744 745 .. option:: +yaml, +noyaml 746 747 When enabled, this option prints the responses (and, if :option:`+qr` is in use, also the 748 outgoing queries) in a detailed YAML format. 749 750 .. option:: +zflag, +nozflag 751 752 This option sets [or does not set] the last unassigned DNS header flag in a DNS query. 753 This flag is off by default. 754 755 Multiple Queries 756 ~~~~~~~~~~~~~~~~ 757 758 The BIND 9 implementation of :program:`dig` supports specifying multiple 759 queries on the command line (in addition to supporting the :option:`-f` batch 760 file option). Each of those queries can be supplied with its own set of 761 flags, options, and query options. 762 763 In this case, each ``query`` argument represents an individual query in 764 the command-line syntax described above. Each consists of any of the 765 standard options and flags, the name to be looked up, an optional query 766 type and class, and any query options that should be applied to that 767 query. 768 769 A global set of query options, which should be applied to all queries, 770 can also be supplied. These global query options must precede the first 771 tuple of name, class, type, options, flags, and query options supplied 772 on the command line. Any global query options (except :option:`+cmd` and 773 :option:`+short` options) can be overridden by a query-specific set of 774 query options. For example: 775 776 :: 777 778 dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr 779 780 shows how :program:`dig` can be used from the command line to make three 781 lookups: an ANY query for ``www.isc.org``, a reverse lookup of 127.0.0.1, 782 and a query for the NS records of ``isc.org``. A global query option of 783 :option:`+qr` is applied, so that :program:`dig` shows the initial query it made for 784 each lookup. The final query has a local query option of :option:`+noqr` which 785 means that :program:`dig` does not print the initial query when it looks up the 786 NS records for ``isc.org``. 787 788 Return Codes 789 ~~~~~~~~~~~~ 790 791 :program:`dig` return codes are: 792 793 ``0`` 794 DNS response received, including NXDOMAIN status 795 796 ``1`` 797 Usage error 798 799 ``8`` 800 Couldn't open batch file 801 802 ``9`` 803 No reply from server 804 805 ``10`` 806 Internal error 807 808 Files 809 ~~~~~ 810 811 ``/etc/resolv.conf`` 812 813 ``${HOME}/.digrc`` 814 815 See Also 816 ~~~~~~~~ 817 818 :iscman:`delv(1) <delv>`, :iscman:`host(1) <host>`, :iscman:`named(8) <named>`, :iscman:`dnssec-keygen(8) <dnssec-keygen>`, :rfc:`1035`. 819 820 Bugs 821 ~~~~ 822 823 There are probably too many query options. 824