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] [-x addr] [-y [hmac:]name:key] [-4]
11           [-6] [name] [type] [class] [queryopt...]
12
13       dig [-h]
14
15       dig [global-queryopt...] [query...]
16

DESCRIPTION

18       dig (domain information groper) is a flexible tool for interrogating
19       DNS name servers. It performs DNS lookups and displays the answers that
20       are returned from the name server(s) that were queried. Most DNS
21       administrators use dig to troubleshoot DNS problems because of its
22       flexibility, ease of use and clarity of output. Other lookup tools tend
23       to have less functionality 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 addreses
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.
42
43       The IN and CH class names overlap with the IN and CH top level domains
44       names. Either use the -t and -c options to specify the type and class,
45       use the -q the specify the domain name, or use "IN." and "CH." when
46       looking up these top level domains.
47

SIMPLE USAGE

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

OPTIONS

77       The -b option sets the source IP address of the query to address. This
78       must be a valid address on one of the host's network interfaces or
79       "0.0.0.0" or "::". An optional port may be specified by appending
80       "#<port>"
81
82       The default query class (IN for internet) is overridden by the -c
83       option.  class is any valid class, such as HS for Hesiod records or CH
84       for Chaosnet records.
85
86       The -f option makes dig operate in batch mode by reading a list of
87       lookup requests to process from the file filename. The file contains a
88       number of queries, one per line. Each entry in the file should be
89       organized in the same way they would be presented as queries to dig
90       using the command-line interface.
91
92       The -m option enables memory usage debugging.
93
94       If a non-standard port number is to be queried, the -p option is used.
95       port# is the port number that dig will send its queries instead of the
96       standard DNS port number 53. This option would be used to test a name
97       server that has been configured to listen for queries on a non-standard
98       port number.
99
100       The -4 option forces dig to only use IPv4 query transport. The -6
101       option forces dig to only use IPv6 query transport.
102
103       The -t option sets the query type to type. It can be any valid query
104       type which is supported in BIND 9. The default query type is "A",
105       unless the -x option is supplied to indicate a reverse lookup. A zone
106       transfer can be requested by specifying a type of AXFR. When an
107       incremental zone transfer (IXFR) is required, type is set to ixfr=N.
108       The incremental zone transfer will contain the changes made to the zone
109       since the serial number in the zone's SOA record was N.
110
111       The -q option sets the query name to name. This useful do distinguish
112       the name from other arguments.
113
114       Reverse lookups — mapping addresses to names — are simplified by the -x
115       option.  addr is an IPv4 address in dotted-decimal notation, or a
116       colon-delimited IPv6 address. When this option is used, there is no
117       need to provide the name, class and type arguments.  dig automatically
118       performs a lookup for a name like 11.12.13.10.in-addr.arpa and sets the
119       query type and class to PTR and IN respectively. By default, IPv6
120       addresses are looked up using nibble format under the IP6.ARPA domain.
121       To use the older RFC1886 method using the IP6.INT domain specify the -i
122       option. Bit string labels (RFC2874) are now experimental and are not
123       attempted.
124
125       To sign the DNS queries sent by dig and their responses using
126       transaction signatures (TSIG), specify a TSIG key file using the -k
127       option. You can also specify the TSIG key itself on the command line
128       using the -y option; hmac is the type of the TSIG, name is the name of
129       the TSIG key and key is the actual key. If hmac is not specified, the
130       default is hmac-md5 or if MD5 was disabled hmac-sha256. The key is a
131       base-64 encoded string, typically generated by dnssec-keygen(8).
132       Caution should be taken when using the -y option on multi-user systems
133       as the key can be visible in the output from ps(1) or in the shell's
134       history file. When using TSIG authentication with dig, the name server
135       that is queried needs to know the key and algorithm that is being used.
136       In BIND, this is done by providing appropriate key and server
137       statements in named.conf.
138

QUERY OPTIONS

140       dig provides a number of query options which affect the way in which
141       lookups are made and the results displayed. Some of these set or reset
142       flag bits in the query header, some determine which sections of the
143       answer get printed, and others determine the timeout and retry
144       strategies.
145
146       Each query option is identified by a keyword preceded by a plus sign
147       (+). Some keywords set or reset an option. These may be preceded by the
148       string no to negate the meaning of that keyword. Other keywords assign
149       values to options like the timeout interval. They have the form
150       +keyword=value. The query options are:
151
152       +[no]tcp
153           Use [do not use] TCP when querying name servers. The default
154           behavior is to use UDP unless an AXFR or IXFR query is requested,
155           in which case a TCP connection is used.
156
157       +[no]vc
158           Use [do not use] TCP when querying name servers. This alternate
159           syntax to +[no]tcp is provided for backwards compatibility. The
160           "vc" stands for "virtual circuit".
161
162       +[no]ignore
163           Ignore truncation in UDP responses instead of retrying with TCP. By
164           default, TCP retries are performed.
165
166       +domain=somename
167           Set the search list to contain the single domain somename, as if
168           specified in a domain directive in /etc/resolv.conf, and enable
169           search list processing as if the +search option were given.
170
171       +[no]search
172           Use [do not use] the search list defined by the searchlist or
173           domain directive in resolv.conf (if any). The search list is not
174           used by default.
175
176       +[no]showsearch
177           Perform [do not perform] a search showing intermediate results.
178
179       +[no]defname
180           Deprecated, treated as a synonym for +[no]search
181
182       +[no]aaonly
183           Sets the "aa" flag in the query.
184
185       +[no]aaflag
186           A synonym for +[no]aaonly.
187
188       +[no]adflag
189           Set [do not set] the AD (authentic data) bit in the query. This
190           requests the server to return whether all of the answer and
191           authority sections have all been validated as secure according to
192           the security policy of the server. AD=1 indicates that all records
193           have been validated as secure and the answer is not from a OPT-OUT
194           range. AD=0 indicate that some part of the answer was insecure or
195           not validated. This bit is set by default.
196
197       +[no]cdflag
198           Set [do not set] the CD (checking disabled) bit in the query. This
199           requests the server to not perform DNSSEC validation of responses.
200
201       +[no]cl
202           Display [do not display] the CLASS when printing the record.
203
204       +[no]ttlid
205           Display [do not display] the TTL when printing the record.
206
207       +[no]recurse
208           Toggle the setting of the RD (recursion desired) bit in the query.
209           This bit is set by default, which means dig normally sends
210           recursive queries. Recursion is automatically disabled when the
211           +nssearch or +trace query options are used.
212
213       +[no]nssearch
214           When this option is set, dig attempts to find the authoritative
215           name servers for the zone containing the name being looked up and
216           display the SOA record that each name server has for the zone.
217
218       +[no]trace
219           Toggle tracing of the delegation path from the root name servers
220           for the name being looked up. Tracing is disabled by default. When
221           tracing is enabled, dig makes iterative queries to resolve the name
222           being looked up. It will follow referrals from the root servers,
223           showing the answer from each server that was used to resolve the
224           lookup.
225
226           +dnssec is also set when +trace is set to better emulate the
227           default queries from a nameserver.
228
229       +[no]cmd
230           Toggles the printing of the initial comment in the output
231           identifying the version of dig and the query options that have been
232           applied. This comment is printed by default.
233
234       +[no]short
235           Provide a terse answer. The default is to print the answer in a
236           verbose form.
237
238       +[no]identify
239           Show [or do not show] the IP address and port number that supplied
240           the answer when the +short option is enabled. If short form answers
241           are requested, the default is not to show the source address and
242           port number of the server that provided the answer.
243
244       +[no]comments
245           Toggle the display of comment lines in the output. The default is
246           to print comments.
247
248       +[no]rrcomments
249           Toggle the display of per-record comments in the output (for
250           example, human-readable key information about DNSKEY records). The
251           default is not to print record comments unless multiline mode is
252           active.
253
254       +split=W
255           Split long hex- or base64-formatted fields in resource records into
256           chunks of W characters (where W is rounded up to the nearest
257           multiple of 4).  +nosplit or +split=0 causes fields not to be split
258           at all. The default is 56 characters, or 44 characters when
259           multiline mode is active.
260
261       +[no]stats
262           This query option toggles the printing of statistics: when the
263           query was made, the size of the reply and so on. The default
264           behavior is to print the query statistics.
265
266       +[no]qr
267           Print [do not print] the query as it is sent. By default, the query
268           is not printed.
269
270       +[no]question
271           Print [do not print] the question section of a query when an answer
272           is returned. The default is to print the question section as a
273           comment.
274
275       +[no]answer
276           Display [do not display] the answer section of a reply. The default
277           is to display it.
278
279       +[no]authority
280           Display [do not display] the authority section of a reply. The
281           default is to display it.
282
283       +[no]additional
284           Display [do not display] the additional section of a reply. The
285           default is to display it.
286
287       +[no]all
288           Set or clear all display flags.
289
290       +time=T
291           Sets the timeout for a query to T seconds. The default timeout is 5
292           seconds. An attempt to set T to less than 1 will result in a query
293           timeout of 1 second being applied.
294
295       +tries=T
296           Sets the number of times to try UDP queries to server to T instead
297           of the default, 3. If T is less than or equal to zero, the number
298           of tries is silently rounded up to 1.
299
300       +retry=T
301           Sets the number of times to retry UDP queries to server to T
302           instead of the default, 2. Unlike +tries, this does not include the
303           initial query.
304
305       +ndots=D
306           Set the number of dots that have to appear in name to D for it to
307           be considered absolute. The default value is that defined using the
308           ndots statement in /etc/resolv.conf, or 1 if no ndots statement is
309           present. Names with fewer dots are interpreted as relative names
310           and will be searched for in the domains listed in the search or
311           domain directive in /etc/resolv.conf.
312
313       +bufsize=B
314           Set the UDP message buffer size advertised using EDNS0 to B bytes.
315           The maximum and minimum sizes of this buffer are 65535 and 0
316           respectively. Values outside this range are rounded up or down
317           appropriately. Values other than zero will cause a EDNS query to be
318           sent.
319
320       +edns=#
321           Specify the EDNS version to query with. Valid values are 0 to 255.
322           Setting the EDNS version will cause a EDNS query to be sent.
323           +noedns clears the remembered EDNS version. EDNS is set to 0 by
324           default.
325
326       +[no]multiline
327           Print records like the SOA records in a verbose multi-line format
328           with human-readable comments. The default is to print each record
329           on a single line, to facilitate machine parsing of the dig output.
330
331       +[no]onesoa
332           Print only one (starting) SOA record when performing an AXFR. The
333           default is to print both the starting and ending SOA records.
334
335       +[no]fail
336           Do not try the next server if you receive a SERVFAIL. The default
337           is to not try the next server which is the reverse of normal stub
338           resolver behavior.
339
340       +[no]besteffort
341           Attempt to display the contents of messages which are malformed.
342           The default is to not display malformed answers.
343
344       +[no]dnssec
345           Requests DNSSEC records be sent by setting the DNSSEC OK bit (DO)
346           in the OPT record in the additional section of the query.
347
348       +[no]sigchase
349           Chase DNSSEC signature chains. Requires dig be compiled with
350           -DDIG_SIGCHASE.
351
352       +trusted-key=####
353           Specifies a file containing trusted keys to be used with +sigchase.
354           Each DNSKEY record must be on its own line.
355
356           If not specified, dig will look for /etc/trusted-key.key then
357           trusted-key.key in the current directory.
358
359           Requires dig be compiled with -DDIG_SIGCHASE.
360
361       +[no]topdown
362           When chasing DNSSEC signature chains perform a top-down validation.
363           Requires dig be compiled with -DDIG_SIGCHASE.
364
365       +[no]nsid
366           Include an EDNS name server ID request when sending a query.
367

MULTIPLE QUERIES

369       The BIND 9 implementation of dig supports specifying multiple queries
370       on the command line (in addition to supporting the -f batch file
371       option). Each of those queries can be supplied with its own set of
372       flags, options and query options.
373
374       In this case, each query argument represent an individual query in the
375       command-line syntax described above. Each consists of any of the
376       standard options and flags, the name to be looked up, an optional query
377       type and class and any query options that should be applied to that
378       query.
379
380       A global set of query options, which should be applied to all queries,
381       can also be supplied. These global query options must precede the first
382       tuple of name, class, type, options, flags, and query options supplied
383       on the command line. Any global query options (except the +[no]cmd
384       option) can be overridden by a query-specific set of query options. For
385       example:
386
387           dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
388
389       shows how dig could be used from the command line to make three
390       lookups: an ANY query for www.isc.org, a reverse lookup of 127.0.0.1
391       and a query for the NS records of isc.org. A global query option of +qr
392       is applied, so that dig shows the initial query it made for each
393       lookup. The final query has a local query option of +noqr which means
394       that dig will not print the initial query when it looks up the NS
395       records for isc.org.
396

IDN SUPPORT

398       If dig has been built with IDN (internationalized domain name) support,
399       it can accept and display non-ASCII domain names.  dig appropriately
400       converts character encoding of domain name before sending a request to
401       DNS server or displaying a reply from the server. If you'd like to turn
402       off the IDN support for some reason, define the CHARSET=ASCII
403       environment variable. The IDN support is disabled if the variable is
404       set when dig runs.
405

RETURN CODES

407       Dig return codes are:
408
409           0: Everything went well, including things like NXDOMAIN
410
411           1: Usage error
412
413           8: Couldn't open batch file
414
415           9: No reply from server
416
417           10: Internal error
418

FILES

420       /etc/resolv.conf
421
422       ${HOME}/.digrc
423

SEE ALSO

425       host(1), named(8), dnssec-keygen(8), RFC1035.
426

BUGS

428       There are probably too many query options.
429
431       Copyright © 2004-2011, 2013 Internet Systems Consortium, Inc. ("ISC")
432       Copyright © 2000-2003 Internet Software Consortium.
433
434
435
436BIND9                            Jun 30, 2000                           DIG(1)
Impressum