2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-26 20:17:35 +00:00
bind/bin/dig/dig.1

463 lines
13 KiB
Groff
Raw Normal View History

2000-09-03 18:04:24 +00:00
.\" Copyright (C) @YEARS@ Internet Software Consortium.
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
.\" DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
.\" INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
.\" INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
.\" FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
.\" NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
.\" WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
2000-09-29 18:25:00 +00:00
.\" $Id: dig.1,v 1.4 2000/09/29 18:25:00 mws Exp $
2000-09-03 18:04:24 +00:00
.\"
.Dd Jun 30, 2000
.Dt DIG 1
.Os BIND9 9
.ds vT BIND9 Programmer's Manual
.Sh NAME
.Nm dig
.Nd DNS lookup utility
.Sh SYNOPSIS
.Nm dig
.Op @server
.Op Fl b Ar address
.Op Fl c Ar class
.Op Fl f Ar filename
2000-09-26 23:41:43 +00:00
.Op Fl k Ar filename
2000-09-03 18:04:24 +00:00
.Op Fl p Ar port#
.Op Fl t Ar type
.Op Fl x Ar addr
.Op Fl y Ar name:key
.Op name
.Op type
.Op class
.Op queryopt ...
.Nm dig
.Fl h
.Nm dig
.Op global-queryopt ...
.Op query1
.Op query2 ...
.Sh DESCRIPTION
.Pp
.Nm dig
(domain information groper) is a flexible tool for interrogating DNS
name servers.
It performs DNS lookups and displays the answers that are returned from
the name server(s) that were queried.
Most DNS administrators use
.Nm dig
to troubleshoot DNS problems because of its flexibility, ease of use and
clarity of output.
Other lookup tools tend to have less functionality than
.Nm dig .
.Pp
Although
.Nm dig
2000-09-03 18:04:24 +00:00
is normally used with command-line arguments, it also has a batch
mode of operation for reading lookup requests from a file.
A brief summary of its command-line arguments and options is printed
when the
.Fl h
2000-09-26 23:41:43 +00:00
option is given.
2000-09-03 18:04:24 +00:00
Unlike earlier versions, the BIND9 implementation of
.Nm dig
allows multiple lookups to be issued from the command line.
.Pp
Unless it is told to query a specific name server,
.Nm dig
2000-09-26 23:41:43 +00:00
will try each of the servers listed in
.Pa /etc/resolv.conf .
.Pp
2000-09-03 18:04:24 +00:00
When no command line arguments or options are given,
2000-09-26 23:41:43 +00:00
will perform an NS query for "." (the root).
2000-09-03 18:04:24 +00:00
.Sh SIMPLE USAGE
.Pp
2000-09-26 23:41:43 +00:00
A typical invocation of
2000-09-03 18:04:24 +00:00
.Nm dig
2000-09-26 23:41:43 +00:00
looks like:
2000-09-03 18:04:24 +00:00
.Bd -ragged | -offset indent
2000-09-26 23:41:43 +00:00
.Ic dig Ar @server name type
2000-09-03 18:04:24 +00:00
.Ed
.Pp
where:
.Bl -tag -width server
.It Ar server
is the name or IP address of the name server to query.
An IPv4 address can be provided in dotted-decimal notation.
When the supplied
.Ar server
argument is a hostname,
.Nm dig
resolves that name before querying that name server.
If no
.Ar server
argument is provided,
.Nm dig
consults
.Pa /etc/resolv.conf
and queries the name servers listed there.
The reply from the name server that responds is displayed.
2000-09-03 18:04:24 +00:00
.It Ar name
is the name of the resource record that is to be looked up.
.It Ar type
indicates what type of query is required - ANY, A, MX, SIG, etc.
.Ar type
can be any valid query type.
If no
.Ar type
argument is supplied,
.Nm dig
2000-09-26 23:41:43 +00:00
will perform a lookup for an A record.
2000-09-03 18:04:24 +00:00
.El
.Pp
.Sh OPTIONS
The
.Fl b
2000-09-26 23:41:43 +00:00
option sets the source IP address of the query to
2000-09-03 18:04:24 +00:00
.Ar address .
2000-09-26 23:41:43 +00:00
This must be a valid
2000-09-03 18:04:24 +00:00
address on one of the host's network interfaces.
.Pp
The default query class (IN for internet) is overridden by the
.Fl c
option.
.Ar class
2000-09-26 23:41:43 +00:00
is any valid class, such as HS for Hesiod records or CH for
CHAOSNET records.
2000-09-03 18:04:24 +00:00
.Pp
The
.Fl f
2000-09-26 23:41:43 +00:00
option makes
2000-09-03 18:04:24 +00:00
.Nm dig
operate in batch mode by reading a list of lookup requests to process
from the file
.Ar filename .
2000-09-26 23:41:43 +00:00
The file contains a number of queries, one per line.
2000-09-03 18:04:24 +00:00
Each entry in the file should be organised in the same way they would be
presented as queries to
.Nm dig
using the command-line interface.
.Pp
If a non-standard port number is to be queried, the
.Fl p
option is used.
.Ar port#
is the port number that
.Nm dig
will send its queries instead of the standard DNS port number 53.
This option would be used to test a name server that has been configured
to listen for queries on a non-standard port number.
.Pp
The
.Fl t
option sets the query type to
.Ar type .
It can be any valid query type which is supported in BIND9.
2000-09-26 23:41:43 +00:00
The default query type "A", unless the
2000-09-03 18:04:24 +00:00
.Fl x
option is supplied to indicate a reverse lookup.
2000-09-26 23:41:43 +00:00
A zone transfer can be requested by specifying a type of AXFR.
2000-09-03 18:04:24 +00:00
When an incremental zone transfer (IXFR) is required,
.Ar type
is set to
.Dv ixfr=N .
The incremental zone transfer will contain the changes made to the zone
since the serial number in the zone's SOA record was
.Ar N .
.Pp
Reverse lookups - mapping addresses to names - are simplified
by the
.Fl x
option.
.Ar addr
2000-09-26 23:41:43 +00:00
is an IPv4 address in dotted-decimal notation, or a colon-delimited
IPv6 address.
2000-09-03 18:04:24 +00:00
When this option is used, there is no need to provide the
.Ar name ,
.Ar class
and
.Ar type
arguments.
.Nm dig
automatically performs a lookup for a name like
.Dv 11.12.13.10.in-addr.arpa
and sets the query type and class to PTR and IN respectively.
2000-09-26 23:41:43 +00:00
By default, IPv6 addresses are looked up using the
IP6.ARPA domain and binary labels as defined in RFC2874.
To use the older RFC1886 method using the IP6.INT domain and "nibble" labels,
specify the
.Fl n
(nibble) option.
2000-09-03 18:04:24 +00:00
.Pp
2000-09-26 23:41:43 +00:00
To sign the DNS queries sent by
2000-09-03 18:04:24 +00:00
.Nm dig
2000-09-26 23:41:43 +00:00
and their responses using transaction signatures (TSIG),
specify a TSIG key file using the
.Fl k
option. You can also specify the TSIG key itself on the command
line using the
.Fl y
option;
2000-09-03 18:04:24 +00:00
.Ar name
2000-09-26 23:41:43 +00:00
is the name of the TSIG key and
2000-09-03 18:04:24 +00:00
.Ar key
2000-09-26 23:41:43 +00:00
is the actual key. The key is a base-64 encoded string,
typically generated by
2000-09-03 18:04:24 +00:00
.Xr dnssec-keygen 8 .
Caution should be taken when using the
.Fl y
2000-09-26 23:41:43 +00:00
option on multi-user systems as the key can be visible
in the output from
2000-09-03 18:04:24 +00:00
.Xr ps 1
2000-09-26 23:41:43 +00:00
or in the shell's history file.
2000-09-03 18:04:24 +00:00
When using TSIG authentication with
.Nm dig ,
the name server that is queried needs to know the key and algorithm
that is being used.
2000-09-26 23:41:43 +00:00
In BIND, this is done by providing appropriate
2000-09-03 18:04:24 +00:00
.Dv key{}
and
.Dv server{}
statements in
2000-09-26 23:41:43 +00:00
.Pa named.conf .
2000-09-03 18:04:24 +00:00
.Sh QUERY OPTIONS
.Nm dig
provides a number of query options which affect the way in which
lookups are made and the results displayed.
2000-09-26 23:41:43 +00:00
Some of these set or reset flag bits in the query header,
some determine which sections of the answer get printed,
and others determine the timeout and retry strategies.
2000-09-03 18:04:24 +00:00
.Pp
Each query option is identified by a keyword preceded by a
plus sign: \*q+\*q.
Some keywords set or reset an option.
These may be preceded by the string \*qno\*q to negate the meaning of
that keyword.
Other keywords assign values to options like the timeout interval.
They have the form
.Dv +keyword=value .
The query options are:
.Bl -tag -width +[no]additional
2000-09-26 23:41:43 +00:00
.It +[no]tcp
2000-09-03 18:04:24 +00:00
Use [do not use] TCP when querying name servers.
The default behaviour is to use UDP unless an AXFR or IXFR query is
2000-09-26 23:41:43 +00:00
requested, in which case a TCP connection is used.
.It +[no]vc
2000-09-03 18:04:24 +00:00
Use [do not use] TCP when querying name servers.
This alternate syntax to
2000-09-26 23:41:43 +00:00
.Ar +[no]tcp
is provided for backwards compatibility.
The "vc" stands for "virtual circuit".
.It +[no]ignore
Ignore truncation in UDP responses instead of
retrying with TCP. By default, TCP retries are
performed.
2000-09-03 18:04:24 +00:00
.It +domain=somename
2000-09-26 23:41:43 +00:00
Set the default domain to
.Ar somename ,
as if specified in a
.Dv domain
directive in
.Pa /etc/resolv.conf .
2000-09-03 18:04:24 +00:00
.It +[no]search
Use [do not use] the search list in
.Pa resolv.conf
(if any).
The search list is not used by default.
.It +[no]defname
Use [do not use] the default domain name, if any, in
.Pa resolv.conf
The default is not to append that name to
.Ar name
when making queries.
.It +[no]aaonly
This option does nothing.
It is provided for compatibilty with old versions of
.Nm dig
2000-09-26 23:41:43 +00:00
where it set an unimplemented resolver flag.
2000-09-03 18:04:24 +00:00
.It +[no]adflag
Set [do not set] the AD (authentic data) bit in the query.
2000-09-26 23:41:43 +00:00
The AD bit currently has a standard meaning only in responses,
not in queries, but the ability to set the bit in the query
is provided for completeness.
2000-09-03 18:04:24 +00:00
.It +[no]cdflag
Set [do not set] the CD (checking disabled) bit in the query.
2000-09-26 23:41:43 +00:00
This requests the server to not perform DNSSEC validation
of responses.
2000-09-03 18:04:24 +00:00
.It +[no]recursive
Toggle the setting of the RD (recursion desired) bit in the query.
2000-09-26 23:41:43 +00:00
This bit is set by default, which means
2000-09-03 18:04:24 +00:00
.Nm dig .
2000-09-26 23:41:43 +00:00
normally sends recursive queries.
Recursion is automatically disabled when the
2000-09-03 18:04:24 +00:00
.Ar +nssearch
or
.Ar +trace
query options are used.
.It +[no]nssearch
2000-09-26 23:41:43 +00:00
When this option is set,
2000-09-03 18:04:24 +00:00
.Nm dig
attempts to find the authoritative name servers for the zone containing
the name being looked up and
display the SOA record that each name server has for the zone.
.It +[no]trace
Toggle tracing of the delegation path from the root name servers for
the name being looked up.
Tracing is disabled by default.
When tracing is enabled,
.Nm dig
2000-09-26 23:41:43 +00:00
makes iterative queries to resolve the name being looked up.
2000-09-03 18:04:24 +00:00
It will follow referrals from the root servers, showing
the answer from each server that was used to resolve the lookup.
.It +[no]cmd
toggles the printing of the initial comment in the output identifying
the version of
.Nm dig
and the query options that have been applied.
This comment is printed by default.
.It +[no]short
Provide a terse answer.
2000-09-26 23:41:43 +00:00
The default is to print the answer in a verbose form.
2000-09-03 18:04:24 +00:00
.It +[no]identify
Show [or do not show] the IP address and port number that supplied the
answer when the
.Ar +short
option is enabled.
If short form answers are requested, the default is not to show
the source address and port number of the server that provided the
answer.
.It +[no]comments
Toggle the display of comment lines in the output.
2000-09-26 23:41:43 +00:00
The default is to print comments.
2000-09-29 18:25:00 +00:00
.It +[no]stats
2000-09-03 18:04:24 +00:00
This query option toggles the printing of statistics: when the query was
made, the size of the reply and so on.
The default behaviour is to print the query statistics.
.It +[no]qr
2000-09-26 23:41:43 +00:00
Print [do not print] the query as it is sent.
before sending the query. By default, the query is not printed.
2000-09-03 18:04:24 +00:00
.It +[no]question
Print [do not print] the question section of a query when an answer is
returned.
The default is to print the question section as a comment.
.It +[no]answer
Display [do not display] the answer section of a reply.
2000-09-26 23:41:43 +00:00
The default is to display it.
2000-09-03 18:04:24 +00:00
.It +[no]authority
Display [do not display] the authority section of a reply.
2000-09-26 23:41:43 +00:00
The default is to display it.
2000-09-03 18:04:24 +00:00
.It +[no]additional
Display [do not display] the additional section of a reply.
2000-09-26 23:41:43 +00:00
The default is to display it.
2000-09-03 18:04:24 +00:00
.It +[no]all
Set or clear all display flags
.It +time=T
Sets the timeout for a query to
.Dv T
seconds.
The default time out is 5 seconds.
An attempt to set
.Dv T
to less than 1 will result in a query timeout of 1 second being applied.
.It +tries=A
Sets the number of times to retry UDP queries to server to
.Dv T
instead of the default, 3.
If
.Dv T
is less than or equal to zero, the number of retries is silently rounded
up to 1.
.It +ndots=D
Set the number of dots that have to appear in
.Ar name
to
.Dv D
2000-09-26 23:41:43 +00:00
for it to be considered absolute. The default value is that
defined using the ndots statement in
.Pa /etc/resolv.conf ,
or 1 if no ndots statement is present. Names with fewer
dots are interpreted as relative names and will be searched
for in the domains listed in the
.Dv search
or
.Dv domain
2000-09-03 18:04:24 +00:00
directive in
.Pa /etc/resolv.conf .
.It +bufsize=B
2000-09-26 23:41:43 +00:00
Set the UDP message buffer size advertised using EDNS0 to
2000-09-03 18:04:24 +00:00
.Dv B
bytes.
The maximum and minimum sizes of this buffer are 65535 and 0
respectively.
Values outside this range are rounded up or down appropriately.
.El
.Sh MULTIPLE QUERIES
.Pp
2000-09-26 23:41:43 +00:00
The BIND 9
2000-09-03 18:04:24 +00:00
implementation of
2000-09-26 23:41:43 +00:00
.Nm dig
supports specifying multiple queries on the command line
(in addition to supporting the
.Fl f
batch file option).
2000-09-03 18:04:24 +00:00
Each of those queries can be supplied with its own set of flags,
options and query options.
.Pp
In this case,
.Ar query1 ,
.Ar query2
and so on represent an individual query in the command-line syntax described
above.
Each consists of any of the standard options and flags, the name to be looked
up, an optional query type and class and any query options that should
be applied to that query.
.Pp
A global set of query options, which should be applied to all queries, can
also be supplied.
These global query options must precede the first tuple of name, class, type,
options, flags, and query options supplied on the command line.
2000-09-26 23:41:43 +00:00
Any global query options can be overridden by a
2000-09-03 18:04:24 +00:00
query-specific set of query options.
For example:
.Bd -literal
dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
.Ed
.Pp
shows how
.Nm dig
could be used from the command line to make three lookups: an ANY query
for
.Dv www.isc.org ,
a reverse lookup of 127.0.0.1
and
a query for the NS records of
.Dv isc.org .
A global query option of
.Ar +qr
is applied, so that
.Nm dig
shows the initial query it made for each lookup.
The final query has a local query option of
.Ar +noqr
which means that
.Nm dig
will not print the initial query when it looks up the
NS records for
.Dv isc.org .
.Sh FILES
.Pa /etc/resolv.conf
.Sh SEE ALSO
.Xr host 1 ,
.Xr resolver 5 ,
.Xr named 8 ,
.Xr dnssec-keygen 8 ,
2000-09-26 23:41:43 +00:00
.Xr RFC1035 .
2000-09-03 18:04:24 +00:00
.Sh BUGS
There are probably too many query options.