Table of Contents

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 linetool which can be used to gather information from theDomain Name System servers. Dig has two modes: simpleinteractive mode which makes a single query, and batchwhich executes a query for each in a list of several querylines. All query options are accessible from the commandline.

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-notationInternet address. If this optional field is omitted,dig will attempt to use the default nameserver for your machine.

Note: If a domain name is specified, this will beresolved 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 disposalsomewhere, all that is required is that/etc/resolv.conf be present and indicate where thedefault name servers reside, so that serveritself can be resolved. See resolver(5) for informationon /etc/resolv.conf. (WARNING: Changing/etc/resolv.conf will affect the standard resolverlibrary and potentially several programs which useit.) As an option, the user may set the environmentvariable LOCALRES to name a file which is to beused instead of /etc/resolv.conf (LOCALRES is specificto the dig resolver and not referenced bythe standard resolver). If the LOCALRES variable isnot set or the file is not readable then/etc/resolv.conf will be used.

domain is the domain name for which you are requestinginformation. See OPTIONS [-x] for convenient wayto specify inverse address query.

query-type
is the type of information (DNS query type) thatyou are requesting. If omitted, the default is «a"(T_A = address). The following types are recognized:

a
T_A network address
any
T_ANY all/any information about specified domain
mx
T_MX mail exchanger for the domain
ns
T_NS name servers
soa
T_SOA zone of authority recordhinfo T_HINFO host informationaxfr T_AXFR zone transfer(must ask an authoritative server)
txt
T_TXT arbitrary number of strings

(See RFC 1035 for the complete list.)

query-class
is the network class requested in the query. Ifomitted, the default is «in» (C_IN = Internet).The following classes are recognized:

in
C_IN Internet class domain
any
C_ANY all/any class information

(See RFC 1035 for the complete list.)

Note: «Any» can be used to specify a class and/or atype of query. Dig will parse the first occurrenceof «any» to mean query-type = T_ANY. To specifyquery-class = C_ANY you must either specify «any"twice, or set query-class using «-c» option (seebelow).

OTHER OPTIONS

%ignored-comment
«%» is used to included an argument that is simplynot parsed. This may be useful if running dig inbatch mode. Instead of resolving every @serverdomain-namein a list of queries, you can avoid theoverhead of doing so, and still have the domainname on the command line as a reference. Example:

dig @128.9.0.32 %venera.isi.edu mxisi.edu

-<dig option>
«-» is used to specify an option which effects theoperation of dig. The following options are currentlyavailable (although not guaranteed to beuseful):
-x dot-notation-address
Convenient form to specify inverse addressmapping. Instead of «dig 32.0.9.128.inaddr.arpa» one can simply «dig -x128.9.0.32".
-f file
File for dig batch mode. The file contains alist of query specifications (dig commandlines) which are to be executed successively.Lines beginning with `;', `#', or`\n' are ignored. Other options may stillappear on command line, and will be ineffect for each batch query.
-T time
Time in seconds between start of successivequeries when running in batch mode. Can beused to keep two or more batch dig commandsrunning roughly in sync. Default is zero.
-p port
Port number. Query a name server listeningto a non-standard port number. Default is53.
-P[ping-string]
After query returns, execute a ping(8) commandfor response time comparison. Thisrather unelegantly makes a call to theshell. The last three lines of statistics isprinted for the command:

ping -s server_name 56 3

If the optional «ping string» is present, itreplaces «ping -s» in the shell command.

-t query-type
Specify type of query. May specify either aninteger value to be included in the typefield or use the abbreviated mnemonic asdiscussed above (i.e., mx = T_MX).
-c query-class
Specify class of query. May specify eitheran integer value to be included in the classfield or use the abbreviated mnemonic asdiscussed above (i.e., in = C_IN).
-envsav
This flag specifies that the dig environment(defaults, print options, etc.), after allof the arguments are parsed, should be savedto a file to become the default environment.Useful if you do not like the standard setof defaults and do not desire to include alarge number of options each time dig isused. The environment consists of resolverstate variable flags, timeout, and retriesas well as the flags detailing dig output(see below). If the shell environment variableLOCALDEF is set to the name of a file,this is where the default dig environment issaved. If not, the file «DiG.env» is createdin the current working directory.

Note: LOCALDEF is specific to the digresolver, and will not affect operation ofthe standard resolver library.

Each time dig is executed, it looks for«./DiG.env» or the file specified by theshell environment variable LOCALDEF. If suchfile exists and is readable, then the environmentis restored from this file beforeany arguments are parsed.

-envset
This flag only affects batch query runs.When «-envset» is specified on a line in adig batch file, the dig environment afterthe arguments are parsed, becomes thedefault environment for the duration of thebatch file, or until the next line whichspecifies «-envset".
-[no]stick
This flag only affects batch query runs. Itspecifies that the dig environment (as readinitially or set by «-envset» switch) is tobe restored before each query (line) in adig batch file. The default «-nostick"means that the dig environment does notstick, hence options specified on a singleline in a dig batch file will remain ineffect for subsequent lines (i.e. they arenot restored to the «sticky» default).
+<query option>
«+» is used to specify an option to be changed inthe query packet or to change dig output specifics.Many of these are the same parameters accepted bynslookup(8). If an option requires a parameter,the form is as follows:
+keyword[=value]

Most keywords can be abbreviated. Parsing of the«+» options is very simplistic -- a value mustnot be separated from its keyword by white space.The following keywords are currently available:

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 trunc. errors [noi][no]primary (pr) use/don't use primary server [nopr][no]aaonly (aa) authoritative query 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]
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 retransmissionstrategy used by resolver library when sendingdatagram queries. The algorithm is as follows:

for i = 0 to retry - 1
for j = 1 to num_serverssend_query
wait((time * (2**i)) / num_servers)end
end

(Note: dig always uses a value of 1 fornum_servers.)

DETAILS

Dig once required a slightly modified version of the BINDresolver(3) library. BIND's resolver has (as of BIND 4.9)been augmented to work properly with Dig. Essentially,Dig is a straight-forward (albeit not pretty) effort ofparsing arguments and setting appropriate parameters. Diguses resolver routines res_init(), res_mkquery(),res_send() as well as accessing _res structure.

FILES

/etc/resolv.conf initial domain name and name serveraddresses

ENVIRONMENT

LOCALRES
file to use in place of /etc/resolv.conf
LOCALDEF
default environment file

AUTHOR

Steve Hotz hotz@isi.edu

ACKNOWLEDGMENTS

Dig uses functions from nslookup(8) authored by AndrewCherenson.

BUGS

Dig has a serious case of «creeping featurism» -- theresult of considering several potential uses during it'sdevelopment. It would probably benefit from a rigorousdiet. Similarly, the print flags and granularity of theitems they specify make evident their rather ad hoc genesis.

Dig does not consistently exit nicely (with appropriatestatus) when a problem occurs somewhere in the resolver(NOTE: most of the common exit cases are handled). Thisis particularly annoying when running in batch mode. Ifit exits abnormally (and is not caught), the entire batchaborts; when such an event is trapped, dig simply continueswith the next query.

SEE ALSO

named(8), resolver(3), resolver(5), nslookup(8)


Table of Contents


www.fiveanddime.net

Google
Web www.fiveanddime.net