dig(1M) dig(1M)
NAME
dig - send domain name query packets to name servers
SYNOPSIS
dig [@server] domain [query-type] [query-class] [+query-option]
[-dig-option] [%comment]
DESCRIPTION
dig (domain information groper) is a flexible command line tool which
can be used to gather information from the Domain Name System servers.
dig has two modes: simple interactive mode, which makes a single
query, and batch mode, which executes a query for each in a list of
several query lines. All query options are accessible from the command
line.
The usual simple use of dig will take the form:
dig @server domain query-type query-class
where:
server
may be either a domain name or a dot-notation Internet address.
If this optional field is omitted, dig will attempt to use the
default name server for your machine.
Note: If a domain name is specified, this will be resolved using
the domain name system resolver (i.e., BIND). If your system does
not support DNS, you may have to specify a dot-notation address.
Alternatively, if there is a server at your disposal somewhere,
all that is required is that /etc/resolv.conf be present and
indicate where the default name servers reside, so that server
itself can be resolved. See resolv.conf(4) for information on
/etc/resolv.conf. (WARNING: Changing /etc/resolv.conf will affect
the standard resolver library and potentially several programs
which use it.) As an option, the user may set the environment
variable LOCALRES to name a file which is to be used instead of
/etc/resolv.conf (LOCALRES is specific to the dig resolver and
not referenced by the standard resolver). If the LOCALRES vari-
able is not set or the file is not readable, then
/etc/resolv.conf will be used.
domain
is the domain name for which you are requesting information. See
OTHER OPTIONS [-x] for a convenient way to specify inverse
address query.
query-type
is the type of information (DNS query type) that you are request-
ing. If omitted, the default is a (TA = address). The following
types are recognized:
Page 1 Reliant UNIX 5.44 Printed 11/98
dig(1M) dig(1M)
a TA network address
any TANY all/any information about specified domain
mx TMX mail exchanger for the domain
ns TNS name servers
soa TSOA start of authority record
hinfo THINFO host information
axfr TAXFR zone transfer (must ask an authoritative
server)
txt TTXT arbitrary number of strings
(See RFC 1035 for the complete list.)
query-class
is the network class requested in the query. If omitted, the
default is in (CIN = Internet). The following classes are recog-
nized:
in CIN Internet class domain
any CANY all/any class information
(See RFC 1035 for the complete list.)
Note: any can be used to specify a class and/or a type of query.
dig will parse the first occurrence of any to mean query-type =
TANY. To specify query-class = CANY you must either specify any
twice, or set query-class using -c option described below).
OTHER OPTIONS
%ignored-comment
% is used to included an argument that is simply not parsed. This
may be useful if running dig in batch mode. Instead of resolving
every @server-domain-name in a list of queries, you can avoid the
overhead of doing so, and still have the domain name on the com-
mand line as a reference. Example:
dig @128.9.0.32 %venera.isi.edu mx isi.edu
-dig-option
- is used to specify an option which effects the operation of
dig. The following options are currently available (although not
guaranteed to be useful):
Page 2 Reliant UNIX 5.44 Printed 11/98
dig(1M) dig(1M)
-x dot-notation-address
Convenient form to specify inverse address mapping.
Instead of dig 32.0.9.128.in-addr.arpa one can sim-
ply use dig -x 128.9.0.32.
-f file File for dig batch mode. The file contains a list of
query specifications (dig command lines) which are
to be executed successively. Lines beginning with ;,
#, or \n are ignored. Other options may still appear
on command line, and will be in effect for each
batch query.
-T time Time in seconds between start of successive queries
when running in batch mode. Can be used to keep two
or more batch dig commands running roughly in sync.
Default is zero.
-p port Port number. Query a name server listening to a
non-standard port number. Default is 53.
-P[ping-string]
After query returns, execute a ping(1M) command for
response time comparison. This rather unelegantly
makes a call to the shell. The last three lines of
statistics is printed for the command:
ping -s servername 56 3
If the optional ping-string is present, it replaces
ping -s in the shell command.
-t query-type
Specify type of query. May specify either an integer
value to be included in the type field or use the
abbreviated mnemonic as discussed above (i.e., mx =
TMX).
-c query-class
Specify class of query. May specify either an
integer value to be included in the class field or
use the abbreviated mnemonic as discussed above
(i.e., in = CIN).
-envsav This flag specifies that the dig environment
(defaults, print options, etc.), after all of the
arguments are parsed, should be saved to a file to
become the default environment. Useful if you do not
like the standard set of defaults and do not desire
to include a large number of options each time dig
is used. The environment consists of resolver state
variable flags, timeout, and retries as well as the
flags detailing dig output (see below). If the shell
Page 3 Reliant UNIX 5.44 Printed 11/98
dig(1M) dig(1M)
environment variable LOCALDEF is set to the name of
a file, this is where the default dig environment is
saved. If not, the file DiG.env is created in the
current working directory.
Note: LOCALDEF is specific to the dig resolver, and
will not affect operation of the standard resolver
library.
Each time dig is executed, it looks for ./DiG.env or
the file specified by the shell environment variable
LOCALDEF. If such file exists and is readable, then
the environment is restored from this file before
any arguments are parsed.
-envset This flag only affects batch query runs. When
-envset is specified on a line in a dig batch file,
the dig environment after the arguments are parsed,
becomes the default environment for the duration of
the batch file, or until the next line which speci-
fies -envset.
-[no]stick This flag only affects batch query runs. It speci-
fies that the dig environment (as read initially or
set by -envset switch) is to be restored before each
query (line) in a dig batch file. The default
-nostick means that the dig environment does not
stick, hence options specified on a single line in a
dig batch file will remain in effect for subsequent
lines (i.e. they are not restored to the "sticky"
default).
+query-option
+ is used to specify an option to be changed in the query packet
or to change dig output specifics. Many of these are the same
parameters accepted by nslookup(1M). If an option requires a
parameter, the form is as follows:
+keyword[=value]
Most keywords can be abbreviated. A value must not be separated
from its keyword by white space. The following keywords are
currently available:
Page 4 Reliant UNIX 5.44 Printed 11/98
dig(1M) dig(1M)
__________________________________________________________________
Keyword Abbrev. Meaning [default]
__________________________________________________________________
[no]debug (deb) turn on/off debugging mode [deb]
[no]d2 turn on/off extra debugging mode [nod2]
[no]recurse (rec) use/don't use recursive lookup [rec]
retry=# (ret) set number of retries to # [4]
time=# (ti) set timeout length to # seconds [4]
[no]ko keep open option (implies vc) [noko]
[no]vc use/don't use virtual circuit [novc]
[no]defname (def) use/don't use default domain name [def]
[no]search (sea) use/don't use domain search list [sea]
domain=NAME (do) set default domain name to NAME
[no]ignore (i) ignore/don't ignore truncated errors [noi]
[no]primary (pr) use/don't use primary server [nopr]
[no]aaonly (aa) authoritative answer only flag [noaa]
[no]sort (sor) sort resource records [nosor]
[no]cmd echo parsed arguments [cmd]
[no]stats (st) print query statistics [st]
[no]Header (H) print basic header [H]
[no]header (he) print header flags [he]
[no]ttlid (tt) print TTLs [tt]
[no]cl print class info [nocl]
[no]qr print outgoing query [noqr]
[no]reply (rep) print reply [rep]
[no]ques (qu) print question section [qu]
[no]answer (an) print answer section [an]
[no]author (au) print authoritative section [au]
[no]addit (ad) print additional section [ad]
[ad] pfdef set to default print flags
pfmin set to minimal default print flags
pfset=# set print flags to # (# can be
hex/octal/decimal)
pfand=# bitwise and print flags with #
pfor=# bitwise or print flags with #
The retry and time options affect the retransmission strategy
used by resolver library when sending datagram queries. The algo-
rithm is as follows:
for i = 0 to retry - 1
for j = 1 to numservers
sendquery
wait((time * (2**i)) / numservers)
end
end
(Note: dig always uses a value of 1 for numservers.)
Page 5 Reliant UNIX 5.44 Printed 11/98
dig(1M) dig(1M)
pfset, pfand, and pfor were included to make manipulation of the
various print options less tedious. Below are the currently
defined meanings for the various print flag bits. They may be
combined (ANDed) to achieve various output formats.
PRFSTATS 0x0001 RTT, query & server host, date, message size
PRFCLASS 0x0004 resource record class information
PRFCMD 0x0008 dig command line echo
PRFQUES 0x0010 questions section
PRFANS 0x0020 answers section
PRFAUTH 0x0040 authoritative section
PRFADD 0x0080 additional records section
PRFHEAD1 0x0100 RR section headers & counts
PRFHEAD2 0x0200 pkt header flags
PRFTTLID 0x0400 resource record ttl
PRFHEADX 0x0800 basic header
PRFQUERY 0x1000 outgoing query packet
PRFREPLY 0x2000 reply packet
PRFSORT 0x8000 sort various response sections
PRFDEF 0x2ff9 default dig settings
PRFZONE 0x24f9 default setting for zone transfer
PRFMIN 0xa930 minimalistic dig settings for (future)
automated server testing
When setting the print options, if you want to see information
other than statistics, you should choose to examine the outgoing
(0x1000), incoming (0x2000), or both packets plus the specific
sections of the packet you are interested in.
ENVIRONMENT
LOCALRES
file to use in place of /etc/resolv.conf
LOCALDEF
default environment file
NOTES
dig does not consistently exit nicely (with appropriate status) when a
problem occurs somewhere in the resolver. Nevertheless most of the
common exit cases are handled. This particularly has consequences when
running in batch mode. If it exits abnormally (and is not caught), the
entire batch aborts; when such an event is trapped, dig simply contin-
ues with the next query.
Page 6 Reliant UNIX 5.44 Printed 11/98
dig(1M) dig(1M)
FILES
/etc/resolv.conf
initial domain name and name server addresses
/usr/lib/named/bog.ascii
/usr/lib/named/bog.ps
Name Server Operations Guide for BIND ("BOG"); ASCII and
PostScript format
SEE ALSO
named(1M), nslookup(1M), resolver(3N), resolv.conf(4).
Page 7 Reliant UNIX 5.44 Printed 11/98