Merge from vendor branch GDB:
[dragonfly.git] / contrib / bind-9.2.4rc7 / bin / dig / dig.1
1 .\" Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
2 .\" Copyright (C) 2000, 2001, 2003  Internet Software Consortium.
3 .\"
4 .\" Permission to use, copy, modify, and distribute this software for any
5 .\" purpose with or without fee is hereby granted, provided that the above
6 .\" copyright notice and this permission notice appear in all copies.
7 .\"
8 .\" THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
9 .\" REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 .\" AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
11 .\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 .\" LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
13 .\" OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 .\" PERFORMANCE OF THIS SOFTWARE.
15 .\"
16 .\" $Id: dig.1,v 1.14.2.5 2004/03/15 04:44:38 marka Exp $
17 .\"
18 .TH "DIG" "1" "Jun 30, 2000" "BIND9" ""
19 .SH NAME
20 dig \- DNS lookup utility
21 .SH SYNOPSIS
22 .sp
23 \fBdig\fR [ \fB@server\fR ]  [ \fB-b \fIaddress\fB\fR ]  [ \fB-c \fIclass\fB\fR ]  [ \fB-f \fIfilename\fB\fR ]  [ \fB-k \fIfilename\fB\fR ]  [ \fB-p \fIport#\fB\fR ]  [ \fB-t \fItype\fB\fR ]  [ \fB-x \fIaddr\fB\fR ]  [ \fB-y \fIname:key\fB\fR ]  [ \fBname\fR ]  [ \fBtype\fR ]  [ \fBclass\fR ]  [ \fBqueryopt\fR\fI...\fR ] 
24 .sp
25 \fBdig\fR [ \fB-h\fR ] 
26 .sp
27 \fBdig\fR [ \fBglobal-queryopt\fR\fI...\fR ]  [ \fBquery\fR\fI...\fR ] 
28 .SH "DESCRIPTION"
29 .PP
30 \fBdig\fR (domain information groper) is a flexible tool
31 for interrogating DNS name servers. It performs DNS lookups and
32 displays the answers that are returned from the name server(s) that
33 were queried. Most DNS administrators use \fBdig\fR to
34 troubleshoot DNS problems because of its flexibility, ease of use and
35 clarity of output. Other lookup tools tend to have less functionality
36 than \fBdig\fR.
37 .PP
38 Although \fBdig\fR is normally used with command-line
39 arguments, it also has a batch mode of operation for reading lookup
40 requests from a file. A brief summary of its command-line arguments
41 and options is printed when the \fB-h\fR option is given.
42 Unlike earlier versions, the BIND9 implementation of
43 \fBdig\fR allows multiple lookups to be issued from the
44 command line.
45 .PP
46 Unless it is told to query a specific name server,
47 \fBdig\fR will try each of the servers listed in
48 \fI/etc/resolv.conf\fR.
49 .PP
50 When no command line arguments or options are given, will perform an
51 NS query for "." (the root).
52 .PP
53 It is possible to set per user defaults for \fBdig\fR via
54 \fI${HOME}/.digrc\fR. This file is read and any options in it
55 are applied before the command line arguements.
56 .SH "SIMPLE USAGE"
57 .PP
58 A typical invocation of \fBdig\fR looks like:
59 .sp
60 .nf
61  dig @server name type 
62 .sp
63 .fi
64 where:
65 .TP
66 \fBserver\fR
67 is the name or IP address of the name server to query. This can be an IPv4
68 address in dotted-decimal notation or an IPv6
69 address in colon-delimited notation. When the supplied
70 \fIserver\fR argument is a hostname,
71 \fBdig\fR resolves that name before querying that name
72 server. If no \fIserver\fR argument is provided,
73 \fBdig\fR consults \fI/etc/resolv.conf\fR
74 and queries the name servers listed there. The reply from the name
75 server that responds is displayed.
76 .TP
77 \fBname\fR
78 is the name of the resource record that is to be looked up.
79 .TP
80 \fBtype\fR
81 indicates what type of query is required \(em
82 ANY, A, MX, SIG, etc.
83 \fItype\fR can be any valid query type. If no
84 \fItype\fR argument is supplied,
85 \fBdig\fR will perform a lookup for an A record.
86 .SH "OPTIONS"
87 .PP
88 The \fB-b\fR option sets the source IP address of the query
89 to \fIaddress\fR. This must be a valid address on
90 one of the host's network interfaces.
91 .PP
92 The default query class (IN for internet) is overridden by the
93 \fB-c\fR option. \fIclass\fR is any valid
94 class, such as HS for Hesiod records or CH for CHAOSNET records.
95 .PP
96 The \fB-f\fR option makes \fBdig \fR operate
97 in batch mode by reading a list of lookup requests to process from the
98 file \fIfilename\fR. The file contains a number of
99 queries, one per line. Each entry in the file should be organised in
100 the same way they would be presented as queries to
101 \fBdig\fR using the command-line interface.
102 .PP
103 If a non-standard port number is to be queried, the
104 \fB-p\fR option is used. \fIport#\fR is
105 the port number that \fBdig\fR will send its queries
106 instead of the standard DNS port number 53. This option would be used
107 to test a name server that has been configured to listen for queries
108 on a non-standard port number.
109 .PP
110 The \fB-t\fR option sets the query type to
111 \fItype\fR. It can be any valid query type which is
112 supported in BIND9. The default query type "A", unless the
113 \fB-x\fR option is supplied to indicate a reverse lookup.
114 A zone transfer can be requested by specifying a type of AXFR. When
115 an incremental zone transfer (IXFR) is required,
116 \fItype\fR is set to ixfr=N.
117 The incremental zone transfer will contain the changes made to the zone
118 since the serial number in the zone's SOA record was
119 \fIN\fR.
120 .PP
121 Reverse lookups - mapping addresses to names - are simplified by the
122 \fB-x\fR option. \fIaddr\fR is an IPv4
123 address in dotted-decimal notation, or a colon-delimited IPv6 address.
124 When this option is used, there is no need to provide the
125 \fIname\fR, \fIclass\fR and
126 \fItype\fR arguments. \fBdig\fR
127 automatically performs a lookup for a name like
128 11.12.13.10.in-addr.arpa and sets the query type and
129 class to PTR and IN respectively. By default, IPv6 addresses are
130 looked up using the IP6.ARPA domain and binary labels as defined in
131 RFC2874. To use the older RFC1886 method using the IP6.INT domain and
132 "nibble" labels, specify the \fB-n\fR (nibble) option.
133 .PP
134 To sign the DNS queries sent by \fBdig\fR and their
135 responses using transaction signatures (TSIG), specify a TSIG key file
136 using the \fB-k\fR option. You can also specify the TSIG
137 key itself on the command line using the \fB-y\fR option;
138 \fIname\fR is the name of the TSIG key and
139 \fIkey\fR is the actual key. The key is a base-64
140 encoded string, typically generated by \fBdnssec-keygen\fR(8).
141 Caution should be taken when using the \fB-y\fR option on
142 multi-user systems as the key can be visible in the output from
143 \fBps\fR(1) or in the shell's history file. When
144 using TSIG authentication with \fBdig\fR, the name
145 server that is queried needs to know the key and algorithm that is
146 being used. In BIND, this is done by providing appropriate
147 \fBkey\fR and \fBserver\fR statements in
148 \fInamed.conf\fR.
149 .SH "QUERY OPTIONS"
150 .PP
151 \fBdig\fR provides a number of query options which affect
152 the way in which lookups are made and the results displayed. Some of
153 these set or reset flag bits in the query header, some determine which
154 sections of the answer get printed, and others determine the timeout
155 and retry strategies.
156 .PP
157 Each query option is identified by a keyword preceded by a plus sign
158 (+). Some keywords set or reset an option. These may be preceded
159 by the string no to negate the meaning of that keyword. Other
160 keywords assign values to options like the timeout interval. They
161 have the form \fB+keyword=value\fR.
162 The query options are:
163 .TP
164 \fB+[no]tcp\fR
165 Use [do not use] TCP when querying name servers. The default
166 behaviour is to use UDP unless an AXFR or IXFR query is requested, in
167 which case a TCP connection is used.
168 .TP
169 \fB+[no]vc\fR
170 Use [do not use] TCP when querying name servers. This alternate
171 syntax to \fI+[no]tcp\fR is provided for backwards
172 compatibility. The "vc" stands for "virtual circuit".
173 .TP
174 \fB+[no]ignore\fR
175 Ignore truncation in UDP responses instead of retrying with TCP. By
176 default, TCP retries are performed.
177 .TP
178 \fB+domain=somename\fR
179 Set the search list to contain the single domain
180 \fIsomename\fR, as if specified in a
181 \fBdomain\fR directive in
182 \fI/etc/resolv.conf\fR, and enable search list
183 processing as if the \fI+search\fR option were given.
184 .TP
185 \fB+[no]search\fR
186 Use [do not use] the search list defined by the searchlist or domain
187 directive in \fIresolv.conf\fR (if any).
188 The search list is not used by default.
189 .TP
190 \fB+[no]defname\fR
191 Deprecated, treated as a synonym for \fI+[no]search\fR
192 .TP
193 \fB+[no]aaonly\fR
194 This option does nothing. It is provided for compatibility with old
195 versions of \fBdig\fR where it set an unimplemented
196 resolver flag.
197 .TP
198 \fB+[no]adflag\fR
199 Set [do not set] the AD (authentic data) bit in the query. The AD bit
200 currently has a standard meaning only in responses, not in queries,
201 but the ability to set the bit in the query is provided for
202 completeness.
203 .TP
204 \fB+[no]cdflag\fR
205 Set [do not set] the CD (checking disabled) bit in the query. This
206 requests the server to not perform DNSSEC validation of responses.
207 .TP
208 \fB+[no]recurse\fR
209 Toggle the setting of the RD (recursion desired) bit in the query.
210 This bit is set by default, which means \fBdig\fR
211 normally sends recursive queries. Recursion is automatically disabled
212 when the \fI+nssearch\fR or
213 \fI+trace\fR query options are used.
214 .TP
215 \fB+[no]nssearch\fR
216 When this option is set, \fBdig\fR attempts to find the
217 authoritative name servers for the zone containing the name being
218 looked up and display the SOA record that each name server has for the
219 zone.
220 .TP
221 \fB+[no]trace\fR
222 Toggle tracing of the delegation path from the root name servers for
223 the name being looked up. Tracing is disabled by default. When
224 tracing is enabled, \fBdig\fR makes iterative queries to
225 resolve the name being looked up. It will follow referrals from the
226 root servers, showing the answer from each server that was used to
227 resolve the lookup.
228 .TP
229 \fB+[no]cmd\fR
230 toggles the printing of the initial comment in the output identifying
231 the version of \fBdig\fR and the query options that have
232 been applied. This comment is printed by default.
233 .TP
234 \fB+[no]short\fR
235 Provide a terse answer. The default is to print the answer in a
236 verbose form.
237 .TP
238 \fB+[no]identify\fR
239 Show [or do not show] the IP address and port number that supplied the
240 answer when the \fI+short\fR option is enabled. If
241 short form answers are requested, the default is not to show the
242 source address and port number of the server that provided the answer.
243 .TP
244 \fB+[no]comments\fR
245 Toggle the display of comment lines in the output. The default is to
246 print comments.
247 .TP
248 \fB+[no]stats\fR
249 This query option toggles the printing of statistics: when the query
250 was made, the size of the reply and so on. The default behaviour is
251 to print the query statistics.
252 .TP
253 \fB+[no]qr\fR
254 Print [do not print] the query as it is sent.
255 By default, the query is not printed.
256 .TP
257 \fB+[no]question\fR
258 Print [do not print] the question section of a query when an answer is
259 returned. The default is to print the question section as a comment.
260 .TP
261 \fB+[no]answer\fR
262 Display [do not display] the answer section of a reply. The default
263 is to display it.
264 .TP
265 \fB+[no]authority\fR
266 Display [do not display] the authority section of a reply. The
267 default is to display it.
268 .TP
269 \fB+[no]additional\fR
270 Display [do not display] the additional section of a reply.
271 The default is to display it.
272 .TP
273 \fB+[no]all\fR
274 Set or clear all display flags.
275 .TP
276 \fB+time=T\fR
277 Sets the timeout for a query to
278 \fIT\fR seconds. The default time out is 5 seconds.
279 An attempt to set \fIT\fR to less than 1 will result
280 in a query timeout of 1 second being applied.
281 .TP
282 \fB+tries=T\fR
283 Sets the number of times to retry UDP queries to server to
284 \fIT\fR instead of the default, 3. If
285 \fIT\fR is less than or equal to zero, the number of
286 retries is silently rounded up to 1.
287 .TP
288 \fB+ndots=D\fR
289 Set the number of dots that have to appear in
290 \fIname\fR to \fID\fR for it to be
291 considered absolute. The default value is that defined using the
292 ndots statement in \fI/etc/resolv.conf\fR, or 1 if no
293 ndots statement is present. Names with fewer dots are interpreted as
294 relative names and will be searched for in the domains listed in the
295 \fBsearch\fR or \fBdomain\fR directive in
296 \fI/etc/resolv.conf\fR.
297 .TP
298 \fB+bufsize=B\fR
299 Set the UDP message buffer size advertised using EDNS0 to
300 \fIB\fR bytes. The maximum and minimum sizes of this
301 buffer are 65535 and 0 respectively. Values outside this range are
302 rounded up or down appropriately.
303 .TP
304 \fB+[no]multiline\fR
305 Print records like the SOA records in a verbose multi-line
306 format with human-readable comments. The default is to print
307 each record on a single line, to facilitate machine parsing 
308 of the \fBdig\fR output.
309 .TP
310 \fB+[no]fail\fR
311 Do not try the next server if you receive a SERVFAIL. The default is
312 to not try the next server which is the reverse of normal stub resolver
313 behaviour.
314 .TP
315 \fB+[no]besteffort\fR
316 Attempt to display the contents of messages which are malformed.
317 The default is to not display malformed answers.
318 .TP
319 \fB+[no]dnssec\fR
320 Requests DNSSEC records be sent by setting the DNSSEC OK bit (DO)
321 in the OPT record in the additional section of the query.
322 .SH "MULTIPLE QUERIES"
323 .PP
324 The BIND 9 implementation of \fBdig \fR supports
325 specifying multiple queries on the command line (in addition to
326 supporting the \fB-f\fR batch file option). Each of those
327 queries can be supplied with its own set of flags, options and query
328 options.
329 .PP
330 In this case, each \fIquery\fR argument represent an
331 individual query in the command-line syntax described above. Each
332 consists of any of the standard options and flags, the name to be
333 looked up, an optional query type and class and any query options that
334 should be applied to that query.
335 .PP
336 A global set of query options, which should be applied to all queries,
337 can also be supplied. These global query options must precede the
338 first tuple of name, class, type, options, flags, and query options
339 supplied on the command line. Any global query options (except
340 the \fB+[no]cmd\fR option) can be
341 overridden by a query-specific set of query options. For example:
342 .sp
343 .nf
344 dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
345 .sp
346 .fi
347 shows how \fBdig\fR could be used from the command line
348 to make three lookups: an ANY query for www.isc.org, a
349 reverse lookup of 127.0.0.1 and a query for the NS records of
350 isc.org.
351 A global query option of \fI+qr\fR is applied, so
352 that \fBdig\fR shows the initial query it made for each
353 lookup. The final query has a local query option of
354 \fI+noqr\fR which means that \fBdig\fR
355 will not print the initial query when it looks up the NS records for
356 isc.org.
357 .SH "FILES"
358 .PP
359 \fI/etc/resolv.conf\fR
360 .PP
361 \fI${HOME}/.digrc\fR
362 .SH "SEE ALSO"
363 .PP
364 \fBhost\fR(1),
365 \fBnamed\fR(8),
366 \fBdnssec-keygen\fR(8),
367 \fIRFC1035\fR.
368 .SH "BUGS"
369 .PP
370 There are probably too many query options.