dig - send domain name query packets to name servers
dig [@server] domain [<query-type>] [<query-class>][+<query-option>] [-<dig-option>] [%comment]
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:
(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:
(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).
%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
ping -s server_name 56 3
If the optional «ping string» is present, itreplaces «ping -s» in the shell command.
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.
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:
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.)
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.
/etc/resolv.conf initial domain name and name serveraddresses
Steve Hotz hotz@isi.edu
Dig uses functions from nslookup(8) authored by AndrewCherenson.
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.
named(8), resolver(3), resolver(5), nslookup(8)