1DIG(1)                               BIND9                              DIG(1)
2
3
4

NAME

6       dig - DNS lookup utility
7

SYNOPSIS

9       dig [@server] [-b address] [-c class] [-f filename] [-k filename] [-m]
10           [-p port#] [-q name] [-t type] [-v] [-x addr] [-y [hmac:]name:key]
11           [[-4] | [-6]] [name] [type] [class] [queryopt...]
12
13       dig [-h]
14
15       dig [global-queryopt...] [query...]
16

DESCRIPTION

18       dig is a flexible tool for interrogating DNS name servers. It performs
19       DNS lookups and displays the answers that are returned from the name
20       server(s) that were queried. Most DNS administrators use dig to
21       troubleshoot DNS problems because of its flexibility, ease of use and
22       clarity of output. Other lookup tools tend to have less functionality
23       than dig.
24
25       Although dig is normally used with command-line arguments, it also has
26       a batch mode of operation for reading lookup requests from a file. A
27       brief summary of its command-line arguments and options is printed when
28       the -h option is given. Unlike earlier versions, the BIND 9
29       implementation of dig allows multiple lookups to be issued from the
30       command line.
31
32       Unless it is told to query a specific name server, dig will try each of
33       the servers listed in /etc/resolv.conf. If no usable server addresses
34       are found, dig will send the query to the local host.
35
36       When no command line arguments or options are given, dig will perform
37       an NS query for "." (the root).
38
39       It is possible to set per-user defaults for dig via ${HOME}/.digrc.
40       This file is read and any options in it are applied before the command
41       line arguments. The -r option disables this feature, for scripts that
42       need predictable behaviour.
43
44       The IN and CH class names overlap with the IN and CH top level domain
45       names. Either use the -t and -c options to specify the type and class,
46       use the -q the specify the domain name, or use "IN." and "CH." when
47       looking up these top level domains.
48

SIMPLE USAGE

50       A typical invocation of dig looks like:
51
52            dig @server name type
53
54       where:
55
56       server
57           is the name or IP address of the name server to query. This can be
58           an IPv4 address in dotted-decimal notation or an IPv6 address in
59           colon-delimited notation. When the supplied server argument is a
60           hostname, dig resolves that name before querying that name server.
61
62           If no server argument is provided, dig consults /etc/resolv.conf;
63           if an address is found there, it queries the name server at that
64           address. If either of the -4 or -6 options are in use, then only
65           addresses for the corresponding transport will be tried. If no
66           usable addresses are found, dig will send the query to the local
67           host. The reply from the name server that responds is displayed.
68
69       name
70           is the name of the resource record that is to be looked up.
71
72       type
73           indicates what type of query is required — ANY, A, MX, SIG, etc.
74           type can be any valid query type. If no type argument is supplied,
75           dig will perform a lookup for an A record.
76

OPTIONS

78       -4
79           Use IPv4 only.
80
81       -6
82           Use IPv6 only.
83
84       -b address[#port]
85           Set the source IP address of the query. The address must be a valid
86           address on one of the host's network interfaces, or "0.0.0.0" or
87           "::". An optional port may be specified by appending "#<port>"
88
89       -c class
90           Set the query class. The default class is IN; other classes are HS
91           for Hesiod records or CH for Chaosnet records.
92
93       -f file
94           Batch mode: dig reads a list of lookup requests to process from the
95           given file. Each line in the file should be organized in the same
96           way they would be presented as queries to dig using the
97           command-line interface.
98
99       -i
100           Do reverse IPv6 lookups using the obsolete RFC 1886 IP6.INT domain,
101           which is no longer in use. Obsolete bit string label queries (RFC
102           2874) are not attempted.
103
104       -k keyfile
105           Sign queries using TSIG using a key read from the given file. Key
106           files can be generated using tsig-keygen(8). When using TSIG
107           authentication with dig, the name server that is queried needs to
108           know the key and algorithm that is being used. In BIND, this is
109           done by providing appropriate key and server statements in
110           named.conf.
111
112       -m
113           Enable memory usage debugging.
114
115       -p port
116           Send the query to a non-standard port on the server, instead of the
117           default port 53. This option would be used to test a name server
118           that has been configured to listen for queries on a non-standard
119           port number.
120
121       -q name
122           The domain name to query. This is useful to distinguish the name
123           from other arguments.
124
125       -r
126           Do not read options from ${HOME}/.digrc. This is useful for scripts
127           that need predictable behaviour.
128
129       -t type
130           The resource record type to query. It can be any valid query type.
131           If it is a resource record type supported in BIND 9, it can be
132           given by the type mnemonic (such as "NS" or "AAAA"). The default
133           query type is "A", unless the -x option is supplied to indicate a
134           reverse lookup. A zone transfer can be requested by specifying a
135           type of AXFR. When an incremental zone transfer (IXFR) is required,
136           set the type to ixfr=N. The incremental zone transfer will contain
137           the changes made to the zone since the serial number in the zone's
138           SOA record was N.
139
140           All resource record types can be expressed as "TYPEnn", where "nn"
141           is the number of the type. If the resource record type is not
142           supported in BIND 9, the result will be displayed as described in
143           RFC 3597.
144
145       -u
146           Print query times in microseconds instead of milliseconds.
147
148       -v
149           Print the version number and exit.
150
151       -x addr
152           Simplified reverse lookups, for mapping addresses to names. The
153           addr is an IPv4 address in dotted-decimal notation, or a
154           colon-delimited IPv6 address. When the -x is used, there is no need
155           to provide the name, class and type arguments.  dig automatically
156           performs a lookup for a name like 94.2.0.192.in-addr.arpa and sets
157           the query type and class to PTR and IN respectively. IPv6 addresses
158           are looked up using nibble format under the IP6.ARPA domain (but
159           see also the -i option).
160
161       -y [hmac:]keyname:secret
162           Sign queries using TSIG with the given authentication key.  keyname
163           is the name of the key, and secret is the base64 encoded shared
164           secret.  hmac is the name of the key algorithm; valid choices are
165           hmac-md5, hmac-sha1, hmac-sha224, hmac-sha256, hmac-sha384, or
166           hmac-sha512. If hmac is not specified, the default is hmac-md5 or
167           if MD5 was disabled hmac-sha256.
168
169           NOTE: You should use the -k option and avoid the -y option, because
170           with -y the shared secret is supplied as a command line argument in
171           clear text. This may be visible in the output from ps(1) or in a
172           history file maintained by the user's shell.
173

QUERY OPTIONS

175       dig provides a number of query options which affect the way in which
176       lookups are made and the results displayed. Some of these set or reset
177       flag bits in the query header, some determine which sections of the
178       answer get printed, and others determine the timeout and retry
179       strategies.
180
181       Each query option is identified by a keyword preceded by a plus sign
182       (+). Some keywords set or reset an option. These may be preceded by the
183       string no to negate the meaning of that keyword. Other keywords assign
184       values to options like the timeout interval. They have the form
185       +keyword=value. Keywords may be abbreviated, provided the abbreviation
186       is unambiguous; for example, +cd is equivalent to +cdflag. The query
187       options are:
188
189       +[no]aaflag
190           A synonym for +[no]aaonly.
191
192       +[no]aaonly
193           Sets the "aa" flag in the query.
194
195       +[no]additional
196           Display [do not display] the additional section of a reply. The
197           default is to display it.
198
199       +[no]adflag
200           Set [do not set] the AD (authentic data) bit in the query. This
201           requests the server to return whether all of the answer and
202           authority sections have all been validated as secure according to
203           the security policy of the server. AD=1 indicates that all records
204           have been validated as secure and the answer is not from a OPT-OUT
205           range. AD=0 indicate that some part of the answer was insecure or
206           not validated. This bit is set by default.
207
208       +[no]all
209           Set or clear all display flags.
210
211       +[no]answer
212           Display [do not display] the answer section of a reply. The default
213           is to display it.
214
215       +[no]authority
216           Display [do not display] the authority section of a reply. The
217           default is to display it.
218
219       +[no]badcookie
220           Retry lookup with the new server cookie if a BADCOOKIE response is
221           received.
222
223       +[no]besteffort
224           Attempt to display the contents of messages which are malformed.
225           The default is to not display malformed answers.
226
227       +bufsize=B
228           Set the UDP message buffer size advertised using EDNS0 to B bytes.
229           The maximum and minimum sizes of this buffer are 65535 and 0
230           respectively. Values outside this range are rounded up or down
231           appropriately. Values other than zero will cause a EDNS query to be
232           sent.
233
234       +[no]cdflag
235           Set [do not set] the CD (checking disabled) bit in the query. This
236           requests the server to not perform DNSSEC validation of responses.
237
238       +[no]class
239           Display [do not display] the CLASS when printing the record.
240
241       +[no]cmd
242           Toggles the printing of the initial comment in the output
243           identifying the version of dig and the query options that have been
244           applied. This comment is printed by default.
245
246       +[no]comments
247           Toggle the display of comment lines in the output. The default is
248           to print comments.
249
250       +[no]cookie[=####]
251           Send a COOKIE EDNS option, with optional value. Replaying a COOKIE
252           from a previous response will allow the server to identify a
253           previous client. The default is +cookie.
254
255           +cookie is also set when +trace is set to better emulate the
256           default queries from a nameserver.
257
258       +[no]crypto
259           Toggle the display of cryptographic fields in DNSSEC records. The
260           contents of these field are unnecessary to debug most DNSSEC
261           validation failures and removing them makes it easier to see the
262           common failures. The default is to display the fields. When omitted
263           they are replaced by the string "[omitted]" or in the DNSKEY case
264           the key id is displayed as the replacement, e.g. "[ key id = value
265           ]".
266
267       +[no]defname
268           Deprecated, treated as a synonym for +[no]search
269
270       +[no]dnssec
271           Requests DNSSEC records be sent by setting the DNSSEC OK bit (DO)
272           in the OPT record in the additional section of the query.
273
274       +domain=somename
275           Set the search list to contain the single domain somename, as if
276           specified in a domain directive in /etc/resolv.conf, and enable
277           search list processing as if the +search option were given.
278
279       +dscp=value
280           Set the DSCP code point to be used when sending the query. Valid
281           DSCP code points are in the range [0..63]. By default no code point
282           is explicitly set.
283
284       +[no]edns[=#]
285           Specify the EDNS version to query with. Valid values are 0 to 255.
286           Setting the EDNS version will cause a EDNS query to be sent.
287           +noedns clears the remembered EDNS version. EDNS is set to 0 by
288           default.
289
290       +[no]ednsflags[=#]
291           Set the must-be-zero EDNS flags bits (Z bits) to the specified
292           value. Decimal, hex and octal encodings are accepted. Setting a
293           named flag (e.g. DO) will silently be ignored. By default, no Z
294           bits are set.
295
296       +[no]ednsnegotiation
297           Enable / disable EDNS version negotiation. By default EDNS version
298           negotiation is enabled.
299
300       +[no]ednsopt[=code[:value]]
301           Specify EDNS option with code point code and optionally payload of
302           value as a hexadecimal string.  code can be either an EDNS option
303           name (for example, NSID or ECS), or an arbitrary numeric value.
304           +noednsopt clears the EDNS options to be sent.
305
306       +[no]expire
307           Send an EDNS Expire option.
308
309       +[no]fail
310           Do not try the next server if you receive a SERVFAIL. The default
311           is to not try the next server which is the reverse of normal stub
312           resolver behavior.
313
314       +[no]header-only
315           Send a query with a DNS header without a question section. The
316           default is to add a question section. The query type and query name
317           are ignored when this is set.
318
319       +[no]identify
320           Show [or do not show] the IP address and port number that supplied
321           the answer when the +short option is enabled. If short form answers
322           are requested, the default is not to show the source address and
323           port number of the server that provided the answer.
324
325       +[no]idnin
326           Process [do not process] IDN domain names on input. This requires
327           IDN SUPPORT to have been enabled at compile time.
328
329           The default is to process IDN input when standard output is a tty.
330           The IDN processing on input is disabled when dig output is
331           redirected to files, pipes, and other non-tty file descriptors.
332
333       +[no]idnout
334           Convert [do not convert] puny code on output. This requires IDN
335           SUPPORT to have been enabled at compile time.
336
337           The default is to process puny code on output when standard output
338           is a tty. The puny code processing on output is disabled when dig
339           output is redirected to files, pipes, and other non-tty file
340           descriptors.
341
342       +[no]ignore
343           Ignore truncation in UDP responses instead of retrying with TCP. By
344           default, TCP retries are performed.
345
346       +[no]keepopen
347           Keep the TCP socket open between queries and reuse it rather than
348           creating a new TCP socket for each lookup. The default is
349           +nokeepopen.
350
351       +[no]mapped
352           Allow mapped IPv4 over IPv6 addresses to be used. The default is
353           +mapped.
354
355       +[no]multiline
356           Print records like the SOA records in a verbose multi-line format
357           with human-readable comments. The default is to print each record
358           on a single line, to facilitate machine parsing of the dig output.
359
360       +ndots=D
361           Set the number of dots that have to appear in name to D for it to
362           be considered absolute. The default value is that defined using the
363           ndots statement in /etc/resolv.conf, or 1 if no ndots statement is
364           present. Names with fewer dots are interpreted as relative names
365           and will be searched for in the domains listed in the search or
366           domain directive in /etc/resolv.conf if +search is set.
367
368       +[no]nsid
369           Include an EDNS name server ID request when sending a query.
370
371       +[no]nssearch
372           When this option is set, dig attempts to find the authoritative
373           name servers for the zone containing the name being looked up and
374           display the SOA record that each name server has for the zone.
375
376       +[no]onesoa
377           Print only one (starting) SOA record when performing an AXFR. The
378           default is to print both the starting and ending SOA records.
379
380       +[no]opcode=value
381           Set [restore] the DNS message opcode to the specified value. The
382           default value is QUERY (0).
383
384       +[no]qr
385           Print [do not print] the query as it is sent. By default, the query
386           is not printed.
387
388       +[no]question
389           Print [do not print] the question section of a query when an answer
390           is returned. The default is to print the question section as a
391           comment.
392
393       +[no]rdflag
394           A synonym for +[no]recurse.
395
396       +[no]recurse
397           Toggle the setting of the RD (recursion desired) bit in the query.
398           This bit is set by default, which means dig normally sends
399           recursive queries. Recursion is automatically disabled when the
400           +nssearch or +trace query options are used.
401
402       +retry=T
403           Sets the number of times to retry UDP queries to server to T
404           instead of the default, 2. Unlike +tries, this does not include the
405           initial query.
406
407       +[no]rrcomments
408           Toggle the display of per-record comments in the output (for
409           example, human-readable key information about DNSKEY records). The
410           default is not to print record comments unless multiline mode is
411           active.
412
413       +[no]search
414           Use [do not use] the search list defined by the searchlist or
415           domain directive in resolv.conf (if any). The search list is not
416           used by default.
417
418           'ndots' from resolv.conf (default 1) which may be overridden by
419           +ndots determines if the name will be treated as relative or not
420           and hence whether a search is eventually performed or not.
421
422       +[no]short
423           Provide a terse answer. The default is to print the answer in a
424           verbose form.
425
426       +[no]showsearch
427           Perform [do not perform] a search showing intermediate results.
428
429       +[no]sigchase
430           Chase DNSSEC signature chains. Requires dig be compiled with
431           -DDIG_SIGCHASE. This feature is deprecated. Use delv instead.
432
433       +split=W
434           Split long hex- or base64-formatted fields in resource records into
435           chunks of W characters (where W is rounded up to the nearest
436           multiple of 4).  +nosplit or +split=0 causes fields not to be split
437           at all. The default is 56 characters, or 44 characters when
438           multiline mode is active.
439
440       +[no]stats
441           This query option toggles the printing of statistics: when the
442           query was made, the size of the reply and so on. The default
443           behavior is to print the query statistics.
444
445       +[no]subnet=addr[/prefix-length]
446           Send (don't send) an EDNS Client Subnet option with the specified
447           IP address or network prefix.
448
449           dig +subnet=0.0.0.0/0, or simply dig +subnet=0 for short, sends an
450           EDNS CLIENT-SUBNET option with an empty address and a source
451           prefix-length of zero, which signals a resolver that the client's
452           address information must not be used when resolving this query.
453
454       +[no]tcp
455           Use [do not use] TCP when querying name servers. The default
456           behavior is to use UDP unless a type any or ixfr=N query is
457           requested, in which case the default is TCP. AXFR queries always
458           use TCP.
459
460       +timeout=T
461           Sets the timeout for a query to T seconds. The default timeout is 5
462           seconds. An attempt to set T to less than 1 will result in a query
463           timeout of 1 second being applied.
464
465       +[no]topdown
466           When chasing DNSSEC signature chains perform a top-down validation.
467           Requires dig be compiled with -DDIG_SIGCHASE. This feature is
468           deprecated. Use delv instead.
469
470       +[no]trace
471           Toggle tracing of the delegation path from the root name servers
472           for the name being looked up. Tracing is disabled by default. When
473           tracing is enabled, dig makes iterative queries to resolve the name
474           being looked up. It will follow referrals from the root servers,
475           showing the answer from each server that was used to resolve the
476           lookup.
477
478           If @server is also specified, it affects only the initial query for
479           the root zone name servers.
480
481           +dnssec is also set when +trace is set to better emulate the
482           default queries from a nameserver.
483
484       +tries=T
485           Sets the number of times to try UDP queries to server to T instead
486           of the default, 3. If T is less than or equal to zero, the number
487           of tries is silently rounded up to 1.
488
489       +trusted-key=####
490           Specifies a file containing trusted keys to be used with +sigchase.
491           Each DNSKEY record must be on its own line.
492
493           If not specified, dig will look for /etc/trusted-key.key then
494           trusted-key.key in the current directory.
495
496           Requires dig be compiled with -DDIG_SIGCHASE. This feature is
497           deprecated. Use delv instead.
498
499       +[no]ttlid
500           Display [do not display] the TTL when printing the record.
501
502       +[no]ttlunits
503           Display [do not display] the TTL in friendly human-readable time
504           units of "s", "m", "h", "d", and "w", representing seconds,
505           minutes, hours, days and weeks. Implies +ttlid.
506
507       +[no]unknownformat
508           Print all RDATA in unknown RR type presentation format (RFC 3597).
509           The default is to print RDATA for known types in the type's
510           presentation format.
511
512       +[no]vc
513           Use [do not use] TCP when querying name servers. This alternate
514           syntax to +[no]tcp is provided for backwards compatibility. The
515           "vc" stands for "virtual circuit".
516
517       +[no]zflag
518           Set [do not set] the last unassigned DNS header flag in a DNS
519           query. This flag is off by default.
520

MULTIPLE QUERIES

522       The BIND 9 implementation of dig supports specifying multiple queries
523       on the command line (in addition to supporting the -f batch file
524       option). Each of those queries can be supplied with its own set of
525       flags, options and query options.
526
527       In this case, each query argument represent an individual query in the
528       command-line syntax described above. Each consists of any of the
529       standard options and flags, the name to be looked up, an optional query
530       type and class and any query options that should be applied to that
531       query.
532
533       A global set of query options, which should be applied to all queries,
534       can also be supplied. These global query options must precede the first
535       tuple of name, class, type, options, flags, and query options supplied
536       on the command line. Any global query options (except the +[no]cmd
537       option) can be overridden by a query-specific set of query options. For
538       example:
539
540           dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
541
542       shows how dig could be used from the command line to make three
543       lookups: an ANY query for www.isc.org, a reverse lookup of 127.0.0.1
544       and a query for the NS records of isc.org. A global query option of +qr
545       is applied, so that dig shows the initial query it made for each
546       lookup. The final query has a local query option of +noqr which means
547       that dig will not print the initial query when it looks up the NS
548       records for isc.org.
549

IDN SUPPORT

551       If dig has been built with IDN (internationalized domain name) support,
552       it can accept and display non-ASCII domain names.  dig appropriately
553       converts character encoding of domain name before sending a request to
554       DNS server or displaying a reply from the server. If you'd like to turn
555       off the IDN support for some reason, use parameters +noidnin and
556       +noidnout or define the IDN_DISABLE environment variable.
557

RETURN CODES

559       Dig return codes are:
560
561           0: Everything went well, including things like NXDOMAIN
562
563           1: Usage error
564
565           8: Couldn't open batch file
566
567           9: No reply from server
568
569           10: Internal error
570

FILES

572       /etc/resolv.conf
573
574       ${HOME}/.digrc
575

SEE ALSO

577       delv(1), host(1), named(8), dnssec-keygen(8), RFC 1035.
578

BUGS

580       There are probably too many query options.
581

AUTHOR

583       Internet Systems Consortium, Inc.
584
586       Copyright © 2000-2011, 2013-2019 Internet Systems Consortium, Inc.
587       ("ISC")
588
589
590
591ISC                               2014-02-19                            DIG(1)
Impressum