1DIG(1) BIND9 DIG(1)
2
3
4
6 dig - DNS lookup utility
7
9 dig [@server] [-b address] [-c class] [-f filename] [-k filename]
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
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.
34
35 When no command line arguments or options are given, will perform an NS
36 query for "." (the root).
37
38 It is possible to set per-user defaults for dig via ${HOME}/.digrc.
39 This file is read and any options in it are applied before the command
40 line arguments.
41
42 The IN and CH class names overlap with the IN and CH top level domains
43 names. Either use the -t and -c options to specify the type and class
44 or use the -q the specify the domain name or use "IN." and "CH." when
45 looking up these top level domains.
46
48 A typical invocation of dig looks like:
49
50 dig @server name type
51
52 where:
53
54 server
55 is the name or IP address of the name server to query. This can be
56 an IPv4 address in dotted-decimal notation or an IPv6 address in
57 colon-delimited notation. When the supplied server argument is a
58 hostname, dig resolves that name before querying that name server.
59 If no server argument is provided, dig consults /etc/resolv.conf
60 and queries the name servers listed there. The reply from the name
61 server that responds is displayed.
62
63 name
64 is the name of the resource record that is to be looked up.
65
66 type
67 indicates what type of query is required — ANY, A, MX, SIG, etc.
68 type can be any valid query type. If no type argument is supplied,
69 dig will perform a lookup for an A record.
70
72 The -b option sets the source IP address of the query to address. This
73 must be a valid address on one of the host's network interfaces or
74 "0.0.0.0" or "::". An optional port may be specified by appending
75 "#<port>"
76
77 The default query class (IN for internet) is overridden by the -c
78 option. class is any valid class, such as HS for Hesiod records or CH
79 for Chaosnet records.
80
81 The -f option makes dig operate in batch mode by reading a list of
82 lookup requests to process from the file filename. The file contains a
83 number of queries, one per line. Each entry in the file should be
84 organized in the same way they would be presented as queries to dig
85 using the command-line interface.
86
87 If a non-standard port number is to be queried, the -p option is used.
88 port# is the port number that dig will send its queries instead of the
89 standard DNS port number 53. This option would be used to test a name
90 server that has been configured to listen for queries on a non-standard
91 port number.
92
93 The -4 option forces dig to only use IPv4 query transport. The -6
94 option forces dig to only use IPv6 query transport.
95
96 The -t option sets the query type to type. It can be any valid query
97 type which is supported in BIND 9. The default query type is "A",
98 unless the -x option is supplied to indicate a reverse lookup. A zone
99 transfer can be requested by specifying a type of AXFR. When an
100 incremental zone transfer (IXFR) is required, type is set to ixfr=N.
101 The incremental zone transfer will contain the changes made to the zone
102 since the serial number in the zone's SOA record was N.
103
104 The -q option sets the query name to name. This useful do distinguish
105 the name from other arguments.
106
107 Reverse lookups — mapping addresses to names — are simplified by the -x
108 option. addr is an IPv4 address in dotted-decimal notation, or a
109 colon-delimited IPv6 address. When this option is used, there is no
110 need to provide the name, class and type arguments. dig automatically
111 performs a lookup for a name like 11.12.13.10.in-addr.arpa and sets the
112 query type and class to PTR and IN respectively. By default, IPv6
113 addresses are looked up using nibble format under the IP6.ARPA domain.
114 To use the older RFC1886 method using the IP6.INT domain specify the -i
115 option. Bit string labels (RFC2874) are now experimental and are not
116 attempted.
117
118 To sign the DNS queries sent by dig and their responses using
119 transaction signatures (TSIG), specify a TSIG key file using the -k
120 option. You can also specify the TSIG key itself on the command line
121 using the -y option; hmac is the type of the TSIG, default HMAC-MD5,
122 name is the name of the TSIG key and key is the actual key. The key is
123 a base-64 encoded string, typically generated by dnssec-keygen(8).
124 Caution should be taken when using the -y option on multi-user systems
125 as the key can be visible in the output from ps(1) or in the shell's
126 history file. When using TSIG authentication with dig, the name server
127 that is queried needs to know the key and algorithm that is being used.
128 In BIND, this is done by providing appropriate key and server
129 statements in named.conf.
130
132 dig provides a number of query options which affect the way in which
133 lookups are made and the results displayed. Some of these set or reset
134 flag bits in the query header, some determine which sections of the
135 answer get printed, and others determine the timeout and retry
136 strategies.
137
138 Each query option is identified by a keyword preceded by a plus sign
139 (+). Some keywords set or reset an option. These may be preceded by the
140 string no to negate the meaning of that keyword. Other keywords assign
141 values to options like the timeout interval. They have the form
142 +keyword=value. The query options are:
143
144 +[no]tcp
145 Use [do not use] TCP when querying name servers. The default
146 behavior is to use UDP unless an AXFR or IXFR query is requested,
147 in which case a TCP connection is used.
148
149 +[no]vc
150 Use [do not use] TCP when querying name servers. This alternate
151 syntax to +[no]tcp is provided for backwards compatibility. The
152 "vc" stands for "virtual circuit".
153
154 +[no]ignore
155 Ignore truncation in UDP responses instead of retrying with TCP. By
156 default, TCP retries are performed.
157
158 +domain=somename
159 Set the search list to contain the single domain somename, as if
160 specified in a domain directive in /etc/resolv.conf, and enable
161 search list processing as if the +search option were given.
162
163 +[no]search
164 Use [do not use] the search list defined by the searchlist or
165 domain directive in resolv.conf (if any). The search list is not
166 used by default.
167
168 +[no]showsearch
169 Perform [do not perform] a search showing intermediate results.
170
171 +[no]defname
172 Deprecated, treated as a synonym for +[no]search
173
174 +[no]aaonly
175 Sets the "aa" flag in the query.
176
177 +[no]aaflag
178 A synonym for +[no]aaonly.
179
180 +[no]adflag
181 Set [do not set] the AD (authentic data) bit in the query. The AD
182 bit currently has a standard meaning only in responses, not in
183 queries, but the ability to set the bit in the query is provided
184 for completeness.
185
186 +[no]cdflag
187 Set [do not set] the CD (checking disabled) bit in the query. This
188 requests the server to not perform DNSSEC validation of responses.
189
190 +[no]cl
191 Display [do not display] the CLASS when printing the record.
192
193 +[no]ttlid
194 Display [do not display] the TTL when printing the record.
195
196 +[no]recurse
197 Toggle the setting of the RD (recursion desired) bit in the query.
198 This bit is set by default, which means dig normally sends
199 recursive queries. Recursion is automatically disabled when the
200 +nssearch or +trace query options are used.
201
202 +[no]nssearch
203 When this option is set, dig attempts to find the authoritative
204 name servers for the zone containing the name being looked up and
205 display the SOA record that each name server has for the zone.
206
207 +[no]trace
208 Toggle tracing of the delegation path from the root name servers
209 for the name being looked up. Tracing is disabled by default. When
210 tracing is enabled, dig makes iterative queries to resolve the name
211 being looked up. It will follow referrals from the root servers,
212 showing the answer from each server that was used to resolve the
213 lookup.
214
215 +[no]cmd
216 Toggles the printing of the initial comment in the output
217 identifying the version of dig and the query options that have been
218 applied. This comment is printed by default.
219
220 +[no]short
221 Provide a terse answer. The default is to print the answer in a
222 verbose form.
223
224 +[no]identify
225 Show [or do not show] the IP address and port number that supplied
226 the answer when the +short option is enabled. If short form answers
227 are requested, the default is not to show the source address and
228 port number of the server that provided the answer.
229
230 +[no]comments
231 Toggle the display of comment lines in the output. The default is
232 to print comments.
233
234 +[no]stats
235 This query option toggles the printing of statistics: when the
236 query was made, the size of the reply and so on. The default
237 behavior is to print the query statistics.
238
239 +[no]qr
240 Print [do not print] the query as it is sent. By default, the query
241 is not printed.
242
243 +[no]question
244 Print [do not print] the question section of a query when an answer
245 is returned. The default is to print the question section as a
246 comment.
247
248 +[no]answer
249 Display [do not display] the answer section of a reply. The default
250 is to display it.
251
252 +[no]authority
253 Display [do not display] the authority section of a reply. The
254 default is to display it.
255
256 +[no]additional
257 Display [do not display] the additional section of a reply. The
258 default is to display it.
259
260 +[no]all
261 Set or clear all display flags.
262
263 +time=T
264 Sets the timeout for a query to T seconds. The default timeout is 5
265 seconds. An attempt to set T to less than 1 will result in a query
266 timeout of 1 second being applied.
267
268 +tries=T
269 Sets the number of times to try UDP queries to server to T instead
270 of the default, 3. If T is less than or equal to zero, the number
271 of tries is silently rounded up to 1.
272
273 +retry=T
274 Sets the number of times to retry UDP queries to server to T
275 instead of the default, 2. Unlike +tries, this does not include the
276 initial query.
277
278 +ndots=D
279 Set the number of dots that have to appear in name to D for it to
280 be considered absolute. The default value is that defined using the
281 ndots statement in /etc/resolv.conf, or 1 if no ndots statement is
282 present. Names with fewer dots are interpreted as relative names
283 and will be searched for in the domains listed in the search or
284 domain directive in /etc/resolv.conf.
285
286 +bufsize=B
287 Set the UDP message buffer size advertised using EDNS0 to B bytes.
288 The maximum and minimum sizes of this buffer are 65535 and 0
289 respectively. Values outside this range are rounded up or down
290 appropriately. Values other than zero will cause a EDNS query to be
291 sent.
292
293 +edns=#
294 Specify the EDNS version to query with. Valid values are 0 to 255.
295 Setting the EDNS version will cause a EDNS query to be sent.
296 +noedns clears the remembered EDNS version.
297
298 +[no]multiline
299 Print records like the SOA records in a verbose multi-line format
300 with human-readable comments. The default is to print each record
301 on a single line, to facilitate machine parsing of the dig output.
302
303 +[no]fail
304 Do not try the next server if you receive a SERVFAIL. The default
305 is to not try the next server which is the reverse of normal stub
306 resolver behavior.
307
308 +[no]besteffort
309 Attempt to display the contents of messages which are malformed.
310 The default is to not display malformed answers.
311
312 +[no]dnssec
313 Requests DNSSEC records be sent by setting the DNSSEC OK bit (DO)
314 in the OPT record in the additional section of the query.
315
316 +[no]sigchase
317 Chase DNSSEC signature chains. Requires dig be compiled with
318 -DDIG_SIGCHASE.
319
320 +trusted-key=####
321 Specifies a file containing trusted keys to be used with +sigchase.
322 Each DNSKEY record must be on its own line.
323
324 If not specified dig will look for /etc/trusted-key.key then
325 trusted-key.key in the current directory.
326
327 Requires dig be compiled with -DDIG_SIGCHASE.
328
329 +[no]topdown
330 When chasing DNSSEC signature chains perform a top-down validation.
331 Requires dig be compiled with -DDIG_SIGCHASE.
332
334 The BIND 9 implementation of dig supports specifying multiple queries
335 on the command line (in addition to supporting the -f batch file
336 option). Each of those queries can be supplied with its own set of
337 flags, options and query options.
338
339 In this case, each query argument represent an individual query in the
340 command-line syntax described above. Each consists of any of the
341 standard options and flags, the name to be looked up, an optional query
342 type and class and any query options that should be applied to that
343 query.
344
345 A global set of query options, which should be applied to all queries,
346 can also be supplied. These global query options must precede the first
347 tuple of name, class, type, options, flags, and query options supplied
348 on the command line. Any global query options (except the +[no]cmd
349 option) can be overridden by a query-specific set of query options. For
350 example:
351
352 dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
353
354 shows how dig could be used from the command line to make three
355 lookups: an ANY query for www.isc.org, a reverse lookup of 127.0.0.1
356 and a query for the NS records of isc.org. A global query option of +qr
357 is applied, so that dig shows the initial query it made for each
358 lookup. The final query has a local query option of +noqr which means
359 that dig will not print the initial query when it looks up the NS
360 records for isc.org.
361
363 If dig has been built with IDN (internationalized domain name) support,
364 it can accept and display non-ASCII domain names. dig appropriately
365 converts character encoding of domain name before sending a request to
366 DNS server or displaying a reply from the server. If you'd like to turn
367 off the IDN support for some reason, defines the IDN_DISABLE
368 environment variable. The IDN support is disabled if the variable is
369 set when dig runs.
370
372 /etc/resolv.conf
373
374 ${HOME}/.digrc
375
377 host(1), named(8), dnssec-keygen(8), RFC1035.
378
380 There are probably too many query options.
381
383 Copyright © 2004-2007 Internet Systems Consortium, Inc. ("ISC")
384 Copyright © 2000-2003 Internet Software Consortium.
385
386
387
388BIND9 Jun 30, 2000 DIG(1)