|
System Administration Commands | dig(1M) |
| dig - send domain name query packets to name servers |
SYNOPSIS
| dig [@server] domain [query-type] [query-class] [+query-option] [-dig-option] [%ignored-comment] |
|
Use dig ("domain information groper") to gather information from the Domain Name System ("DNS") servers. dig has two modes, simple interactive mode for a single query, and batch mode, which executes a query for each line in a
list of several query lines. All query options are accessible from the command line.
|
|
The dig utility supports the following options:
-
@server
- Either a domain name or a dot-notation Internet address. If this field is omitted, dig attempts to use the default name server for the machine. If a domain name is specified, this will be resolved using
the domain name system resolver, for example, BIND. If the system does not support DNS, specify a dot-notation address. Alternatively, /etc/resolv.conf should be present. It indicates where the default name servers reside, so that server itself can be resolved. See resolver(3RESOLV) for information on /etc/resolv.conf. As an option, set the environment variable LOCALRES to name a file
which is to be used instead of the /etc/resolv.conf standard resolver. LOCALRES is specific to the dig resolver and is not referenced by the system resolver. If the LOCALRES variable is not set or the specified file is not
readable, then /etc/resolv.conf will be used.
- -domain
- The domain name for which you are requesting information. See the -x option for a convenient way to specify an inverse address query.
-
query-type
- The type of information (DNS query type) that you are requesting. If omitted, the default is a (T_A=address). The following types are recognized:
a | T_A | network address |
any | T_ANY | any and all 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 an authoritative server) |
txt | T_TXT | arbitrary number of strings |
See RFC 1035 for a complete list of values for query-type.
-
query-class
- The network class requested in the query. If omitted, the default is in (C_IN=Internet). The following classes are recognized:
in | C_IN | Internet class domain |
any | C_ANY | any and all class information |
See RFC 1035 for a complete list of values for query-class.
any can be used to specify a class and a type of query. dig parses the first occurrence of any to mean query-type=T_ANY. To specify query-class=C_ANY, either specify any twice, or
set query-class using the -c option.
-
%ignored-comment
- ``%'' is used to include an argument that is not parsed. This is useful when running dig in batch mode. For example:
|
example% dig @128.9.0.32 %venera.isi.edu mx isi.edu
|
- -dig option
- ``-'' is used to specify an option that affects the operation of dig. The following options are currently available:
- -x dot-notation-address
- Specify inverse address mapping. Instead of:
|
example% dig 32.0.9.128.in-addr.arpa
|
Specify:
|
example% dig -x 128.9.0.32
|
- -f file
- Batch mode. file contains a list of query specifications, that is, dig command lines, which are to be executed successively. Lines that begin with `;',
`#', or `\n' are ignored. Other options may still appear on command line that will be in effect for each batch query.
- -T time
- Specify the time in seconds between the start of successive queries in batch mode. This option can be used synchronize two or more batch dig commands. The default is zero.
- -p port
- Specify port number. This option allows you to query a name server that listens to a non-standard port number. The default is 53.
- -P [ping-string]
- After query returns, execute a ping(1M) command for response time comparison. This option
makes a call to the shell. The last three ,lines of statistics are printed for the command:
|
example % ping -s -server_name -56 -3
|
If the optional ping_string is present, it replaces ping -s in the shell command.
- -t query-type
- Specify type of query. You may specify either an integer value to be included in the type field, or use the abbreviated mnemonic. for example, mx = T_MX.
- -c query-class
- Specify class of query. You may specify either an integer value to be included in the class field, or use the abbreviated mnemonic, for example, in = C_IN.
- -k keydir:keyname
- Sign the query with the TSIG key named keyname that is in the directory keydir.
- -envsav
- Specifies that after all of the arguments are parsed, the dig environment should be saved to a file to become the default environment. This is useful to bypass the standard set of defaults and use a custom set 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. If the shell 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.
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. The DiG.env file contains binary data and should not be modified directly.
- -envset
- Specifies that after the arguments are parsed, the dig environment becomes the default environment for the duration of the batch file, or until the next line that specifies -envset. This flag is set
by including it in a line in a dig batch file. It only affects batch query runs.
- - [no] stick
- Specifies that the dig environment, either as read initially or set by the -envset option, 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, that is, they are not restored to the "sticky" default. This option only affects batch
query runs.
- +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:
Most keywords can be abbreviated. The 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 | Abbreviation | Meaning [default] |
[no] debug | [deb] | Turn on or off debugging mode[deb] |
[no] d2 | | Turn on or off extra debugging mode [nod2] |
[no] recurse | [rec] | Use or 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 or do not use virtual circuit [novc] |
[no] defname | [def] | Use or do not use default domain name [def] |
[no] search | [sea] | Use or do not use domain search list [sea] |
domain=NAME | [do] | Set default domain name to NAME |
[no] ignore | [i] | Ignore or do not ignore truncated errors [noi] |
[no] primary | [pr] | Use or do not use primary server [nopr] |
[no] aaonly | [aa] | Authoritative query only flag [noaa] |
[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 #. The value of # can be hex, octal, or decimal. |
pfand=# | | Bitwise and print flags with # |
pfor=# | | Bitwise or print flags with # |
The retry and time options affect the retransmission strategy used by the resolver library() when sending datagram queries. The algorithm is as follows:
|
for i = 0 to retry - 1
for j = 1 to num_servers
send_query
wait((time * (2**i)) / num_servers)
end
end
|
dig always uses a value of 1 for num_servers.
|
|
-
LOCALRES
- File to use in place of /etc/resolv.conf
-
LOCALDEF
- default environment file
|
|
-
/etc/resolv.conf
- Initial domain name and name server addresses
-
./DiG.env
- Default save file for default options
|
|
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
Availability | SUNWcsu |
Interface Stability | External |
|
|
dig does not consistently exit with appropriate status messages when a problem occurs somewhere in the resolver(), although most of the common exit cases are handled. This can be problematic when running in batch mode. If dig exits abnormally
and is not caught, the entire batch aborts. When such an event is trapped, dig simply continues with the next query.
|
| |