Unless it is told to query a specific name server,
<
command>dig</
command> will try each of the servers listed
When no command line arguments or options are given,
<
command>dig</
command> will perform an NS query for "." (the root).
It is possible to set per-user defaults for <
command>dig</
command> via
<
filename>${HOME}/.digrc</
filename>. This file is read and
are applied before the command line arguments.
The IN and CH class names overlap with the IN and CH top level
domains names. Either use the <
option>-t</
option> and
<
option>-c</
option> options to specify the type and class,
use the <
option>-q</
option> the specify the domain name, or
use "IN." and "CH." when looking up these top level domains.
<
title>SIMPLE USAGE</
title>
A typical invocation of <
command>dig</
command> looks like:
<
programlisting> dig @server name type </
programlisting>
<
term><
constant>server</
constant></
term>
is the name or IP address of the name server to query. This can
address in dotted-decimal notation or an IPv6
address in colon-delimited notation. When the supplied
<
parameter>server</
parameter> argument is a
<
command>dig</
command> resolves that name before
server. If no <
parameter>server</
parameter>
and queries the name servers listed there. The reply from the
server that responds is displayed.
<
term><
constant>name</
constant></
term>
is the name of the resource record that is to be looked up.
<
term><
constant>type</
constant></
term>
indicates what type of query is required —
<
parameter>type</
parameter> can be any valid query
<
parameter>type</
parameter> argument is supplied,
<
command>dig</
command> will perform a lookup for an
The <
option>-b</
option> option sets the source IP address of the query
to <
parameter>address</
parameter>. This must be a valid
one of the host's network interfaces or "0.0.0.0" or "::". An optional
may be specified by appending "#<port>"
The default query class (IN for internet) is overridden by the
<
option>-c</
option> option. <
parameter>class</
parameter> is
class, such as HS for Hesiod records or CH for Chaosnet records.
The <
option>-f</
option> option makes <
command>dig </
command>
in batch mode by reading a list of lookup requests to process from the
file <
parameter>filename</
parameter>. The file contains a
queries, one per line. Each entry in the file should be organized in
the same way they would be presented as queries to
<
command>dig</
command> using the command-line interface.
The <
option>-m</
option> option enables memory usage debugging.
<!-- It enables ISC_MEM_DEBUGTRACE and ISC_MEM_DEBUGRECORD If a non-standard port number is to be queried, the
<
option>-p</
option> option is used. <
parameter>port#</
parameter> is
the port number that <
command>dig</
command> will send its
instead of the standard DNS port number 53. This option would be used
to test a name server that has been configured to listen for queries
on a non-standard port number.
The <
option>-4</
option> option forces <
command>dig</
command>
use IPv4 query transport. The <
option>-6</
option> option forces
<
command>dig</
command> to only use IPv6 query transport.
The <
option>-t</
option> option sets the query type to
<
parameter>type</
parameter>. It can be any valid query type
supported in BIND 9. The default query type is "A", unless the
<
option>-x</
option> option is supplied to indicate a reverse lookup.
A zone transfer can be requested by specifying a type of AXFR. When
an incremental zone transfer (IXFR) is required,
<
parameter>type</
parameter> is set to <
literal>ixfr=N</
literal>.
The incremental zone transfer will contain the changes made to the zone
since the serial number in the zone's SOA record was
<
parameter>N</
parameter>.
The <
option>-q</
option> option sets the query name to
<
parameter>name</
parameter>. This useful do distinguish the
<
parameter>name</
parameter> from other arguments.
Reverse lookups — mapping addresses to names — are simplified by the
<
option>-x</
option> option. <
parameter>addr</
parameter> is
address in dotted-decimal notation, or a colon-delimited IPv6 address.
When this option is used, there is no need to provide the
<
parameter>name</
parameter>, <
parameter>class</
parameter> and
<
parameter>type</
parameter> arguments. <
command>dig</
command>
automatically performs a lookup for a name like
class to PTR and IN respectively. By default, IPv6 addresses are
looked up using nibble format under the
IP6.ARPA domain.
To use the older RFC1886 method using the
IP6.INT domain
specify the <
option>-i</
option> option. Bit string labels (RFC2874)
are now experimental and are not attempted.
To sign the DNS queries sent by <
command>dig</
command> and
responses using transaction signatures (TSIG), specify a TSIG key file
using the <
option>-k</
option> option. You can also specify the TSIG
key itself on the command line using the <
option>-y</
option> option;
<
parameter>hmac</
parameter> is the type of the TSIG, default HMAC-MD5,
<
parameter>name</
parameter> is the name of the TSIG key and
<
parameter>key</
parameter> is the actual key. The key is a
encoded string, typically generated by
<
refentrytitle>dnssec-keygen</
refentrytitle><
manvolnum>8</
manvolnum>
Caution should be taken when using the <
option>-y</
option> option on
multi-user systems as the key can be visible in the output from
<
refentrytitle>ps</
refentrytitle><
manvolnum>1</
manvolnum>
or in the shell's history file. When
using TSIG authentication with <
command>dig</
command>, the name
server that is queried needs to know the key and algorithm that is
being used. In BIND, this is done by providing appropriate
<
command>key</
command> and <
command>server</
command> statements in
<
title>QUERY OPTIONS</
title>
<
para><
command>dig</
command>
provides a number of query options which affect
the way in which lookups are made and the results displayed. Some of
these set or reset flag bits in the query header, some determine which
sections of the answer get printed, and others determine the timeout
Each query option is identified by a keyword preceded by a plus sign
(<
literal>+</
literal>). Some keywords set or reset an
option. These may be preceded
by the string <
literal>no</
literal> to negate the meaning of
keywords assign values to options like the timeout interval. They
have the form <
option>+keyword=value</
option>.
<
term><
option>+[no]tcp</
option></
term>
Use [do not use] TCP when querying name servers. The default
behavior is to use UDP unless an AXFR or IXFR query is
which case a TCP connection is used.
<
term><
option>+[no]vc</
option></
term>
Use [do not use] TCP when querying name servers. This alternate
syntax to <
parameter>+[no]tcp</
parameter> is
compatibility. The "vc" stands for "virtual circuit".
<
term><
option>+[no]ignore</
option></
term>
Ignore truncation in UDP responses instead of retrying with TCP.
default, TCP retries are performed.
<
term><
option>+domain=somename</
option></
term>
Set the search list to contain the single domain
<
parameter>somename</
parameter>, as if specified in
<
command>domain</
command> directive in
processing as if the <
parameter>+search</
parameter>
<
term><
option>+[no]search</
option></
term>
Use [do not use] the search list defined by the searchlist or
The search list is not used by default.
<
term><
option>+[no]showsearch</
option></
term>
Perform [do not perform] a search showing intermediate
<
term><
option>+[no]defname</
option></
term>
Deprecated, treated as a synonym for <
parameter>+[no]search</
parameter>
<
term><
option>+[no]aaonly</
option></
term>
Sets the "aa" flag in the query.
<
term><
option>+[no]aaflag</
option></
term>
A synonym for <
parameter>+[no]aaonly</
parameter>.
<
term><
option>+[no]adflag</
option></
term>
Set [do not set] the AD (authentic data) bit in the query. The
currently has a standard meaning only in responses, not in
but the ability to set the bit in the query is provided for
<
term><
option>+[no]cdflag</
option></
term>
Set [do not set] the CD (checking disabled) bit in the query.
requests the server to not perform DNSSEC validation of
<
term><
option>+[no]cl</
option></
term>
Display [do not display] the CLASS when printing the record.
<
term><
option>+[no]ttlid</
option></
term>
Display [do not display] the TTL when printing the record.
<
term><
option>+[no]recurse</
option></
term>
Toggle the setting of the RD (recursion desired) bit in the
This bit is set by default, which means <
command>dig</
command>
normally sends recursive queries. Recursion is automatically
when the <
parameter>+nssearch</
parameter> or
<
parameter>+trace</
parameter> query options are
<
term><
option>+[no]nssearch</
option></
term>
When this option is set, <
command>dig</
command>
authoritative name servers for the zone containing the name
looked up and display the SOA record that each name server has
<
term><
option>+[no]trace</
option></
term>
Toggle tracing of the delegation path from the root name servers
the name being looked up. Tracing is disabled by default. When
tracing is enabled, <
command>dig</
command> makes
resolve the name being looked up. It will follow referrals from
root servers, showing the answer from each server that was used
<
term><
option>+[no]cmd</
option></
term>
Toggles the printing of the initial comment in the output
the version of <
command>dig</
command> and the query
been applied. This comment is printed by default.
<
term><
option>+[no]short</
option></
term>
Provide a terse answer. The default is to print the answer in a
<
term><
option>+[no]identify</
option></
term>
Show [or do not show] the IP address and port number that
answer when the <
parameter>+short</
parameter> option
short form answers are requested, the default is not to show the
source address and port number of the server that provided the
<
term><
option>+[no]comments</
option></
term>
Toggle the display of comment lines in the output. The default
<
term><
option>+[no]stats</
option></
term>
This query option toggles the printing of statistics: when the
was made, the size of the reply and so on. The default
to print the query statistics.
<
term><
option>+[no]qr</
option></
term>
Print [do not print] the query as it is sent.
By default, the query is not printed.
<
term><
option>+[no]question</
option></
term>
Print [do not print] the question section of a query when an
returned. The default is to print the question section as a
<
term><
option>+[no]answer</
option></
term>
Display [do not display] the answer section of a reply. The
<
term><
option>+[no]authority</
option></
term>
Display [do not display] the authority section of a reply. The
default is to display it.
<
term><
option>+[no]additional</
option></
term>
Display [do not display] the additional section of a reply.
The default is to display it.
<
term><
option>+[no]all</
option></
term>
Set or clear all display flags.
<
term><
option>+time=T</
option></
term>
Sets the timeout for a query to
<
parameter>T</
parameter> seconds. The default
An attempt to set <
parameter>T</
parameter> to less
in a query timeout of 1 second being applied.
<
term><
option>+tries=T</
option></
term>
Sets the number of times to try UDP queries to server to
<
parameter>T</
parameter> instead of the default, 3.
<
parameter>T</
parameter> is less than or equal to
tries is silently rounded up to 1.
<
term><
option>+retry=T</
option></
term>
Sets the number of times to retry UDP queries to server to
<
parameter>T</
parameter> instead of the default, 2.
<
parameter>+tries</
parameter>, this does not include
<
term><
option>+ndots=D</
option></
term>
Set the number of dots that have to appear in
<
parameter>name</
parameter> to <
parameter>D</
parameter> for it to be
considered absolute. The default value is that defined using
ndots statement is present. Names with fewer dots are
relative names and will be searched for in the domains listed in
<
option>search</
option> or <
option>domain</
option> directive in
<
term><
option>+bufsize=B</
option></
term>
Set the UDP message buffer size advertised using EDNS0 to
<
parameter>B</
parameter> bytes. The maximum and minimum sizes
of this buffer are 65535 and 0 respectively. Values outside
this range are rounded up or down appropriately.
Values other than zero will cause a EDNS query to be sent.
<
term><
option>+edns=#</
option></
term>
Specify the EDNS version to query with. Valid values
are 0 to 255. Setting the EDNS version will cause a
EDNS query to be sent. <
option>+noedns</
option> clears the
<
term><
option>+[no]multiline</
option></
term>
Print records like the SOA records in a verbose multi-line
format with human-readable comments. The default is to print
each record on a single line, to facilitate machine parsing
of the <
command>dig</
command> output.
<
term><
option>+[no]fail</
option></
term>
Do not try the next server if you receive a SERVFAIL. The
to not try the next server which is the reverse of normal stub
<
term><
option>+[no]besteffort</
option></
term>
Attempt to display the contents of messages which are malformed.
The default is to not display malformed answers.
<
term><
option>+[no]dnssec</
option></
term>
Requests DNSSEC records be sent by setting the DNSSEC OK bit
in the OPT record in the additional section of the query.
<
term><
option>+[no]sigchase</
option></
term>
Chase DNSSEC signature chains. Requires dig be compiled with
<
term><
option>+trusted-key=####</
option></
term>
Specifies a file containing trusted keys to be used with
<
option>+sigchase</
option>. Each DNSKEY record must be
If not specified, <
command>dig</
command> will look for
Requires dig be compiled with -DDIG_SIGCHASE.
<
term><
option>+[no]topdown</
option></
term>
When chasing DNSSEC signature chains perform a top-down
Requires dig be compiled with -DDIG_SIGCHASE.
<
term><
option>+[no]nsid</
option></
term>
Include an EDNS name server ID request when sending a query.
<
title>MULTIPLE QUERIES</
title>
The BIND 9 implementation of <
command>dig </
command>
specifying multiple queries on the command line (in addition to
supporting the <
option>-f</
option> batch file option). Each of those
queries can be supplied with its own set of flags, options and query
In this case, each <
parameter>query</
parameter> argument
individual query in the command-line syntax described above. Each
consists of any of the standard options and flags, the name to be
looked up, an optional query type and class and any query options that
should be applied to that query.
A global set of query options, which should be applied to all queries,
can also be supplied. These global query options must precede the
first tuple of name, class, type, options, flags, and query options
supplied on the command line. Any global query options (except
the <
option>+[no]cmd</
option> option) can be
overridden by a query-specific set of query options. For example:
shows how <
command>dig</
command> could be used from the
to make three lookups: an ANY query for <
literal>
www.isc.org</
literal>, a
reverse lookup of 127.0.0.1 and a query for the NS records of
A global query option of <
parameter>+qr</
parameter> is
that <
command>dig</
command> shows the initial query it made
lookup. The final query has a local query option of
<
parameter>+noqr</
parameter> which means that <
command>dig</
command>
will not print the initial query when it looks up the NS records for
<
title>IDN SUPPORT</
title>
If <
command>dig</
command> has been built with IDN (internationalized
domain name) support, it can accept and display non-ASCII domain names.
<
command>dig</
command> appropriately converts character encoding of
domain name before sending a request to DNS server or displaying a
If you'd like to turn off the IDN support for some reason, defines
the <
envar>IDN_DISABLE</
envar> environment variable.
The IDN support is disabled if the variable is set when
<
command>dig</
command> runs.
<
para><
filename>${HOME}/.digrc</
filename>
<
refentrytitle>host</
refentrytitle><
manvolnum>1</
manvolnum>
<
refentrytitle>named</
refentrytitle><
manvolnum>8</
manvolnum>
<
refentrytitle>dnssec-keygen</
refentrytitle><
manvolnum>8</
manvolnum>
<
citetitle>RFC1035</
citetitle>.
There are probably too many query options.