The simple use of dig takes the following form:
dig @server domain query_type query_class
NOTE: If a domain name is specified, this will be resolved using the Domain Name System (DNS) resolver. 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 that it indicate where the default name servers reside, so that server itself can be resolved. See resolv.conf(4tcp) for more information.
WARNING: Changing /etc/resolv.conf will affect the standard resolver library and potentially several programs which use it.
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 record |
hinfo | T_HINFO | host information |
axfr | T_AXFR | zone transfer (must ask authoritative server) |
rp | T_RP | responsible person records |
txt | T_TXT | arbitrary number of strings |
in | C_IN | Internet class domain |
any | C_ANY | all/any class information |
NOTE: any can specify a class and/or a type of query: dig parses the first occurrence of any to mean query_type = T_ANY. To specify query_class = C_ANY you must either specify any twice or set the query_class using the -c option (see below).
dig @128.9.0.32 %venera.isi.edu mx isi.edu
NOTE: LOCALDEF is specific to the dig resolver and will not affect the operation of the standard resolver library.
Whenever dig is executed, it will look for
./DiG.env or for the file specified by the
shell environment variable LOCALDEF. If such a
file exists and if it is readable, then the environment
will be restored from this file before any arguments are
parsed.
The default value -nostick means that the dig environment should not stick; hence options specified on a single line in a dig batch file will remain in effect for subsequent lines (that is, they will not be restored to the ``sticky'' default).
Most keywords can be abbreviated. Parsing of the ``+'' options is very simplistic -- a value must not 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/do not 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/do not use virtual circuit [novc] | |
[no]defname | def | use/do not use default domain name [def] |
[no]search | sea | use/do not use domain search list [sea] |
domain=NAME | do | set default domain name to NAME |
[no]ignore | i | ignore/do not ignore truncation errors [noi] |
[no]primary | pr | use/do not 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 # (in hex/octal/decimal) | |
pfand=# | bitwise ``and'' print flags with # | |
pfor=# | bitwise ``or'' print flags with # |
for i = 0 to retry-1 for j = 1 to num_servers send_query wait((time * (2**i)) / num_servers) end endNOTE: dig always uses a value of 1 for num_servers.
It is possible to compile dig with the standard resolver library, but this procedure will change the dig output format, make the dig print options meaningless, and not gather RTT and packet count statistics.
RFC 1035
NOTE: Most of the common exit cases are handled.
When running in batch mode: If dig exits abnormally -- and is not caught -- the entire batch will abort; when such an event is trapped, dig will simply continue with the next query.