| DIG(1) | General Commands Manual | DIG(1) |
dig — DNS lookup
utility
dig |
[@server] [-46hiuv]
[-b
sourceaddr[#port]]
[-c class]
[-f file]
[-k keyfile]
[-p port]
[-q name]
[-t type]
[-x addr]
[-y
[hmac:]name:key]
[name] [type]
[class] [+queryopt ...] |
The dig command is a flexible tool for
interrogating DNS name servers. It performs DNS lookups and displays the
answers that are returned from the name servers that were queried. Although
dig is normally used with command line arguments, it
also has a batch mode of operation for reading lookup requests from a file.
When no command line arguments or options are given,
dig will perform an NS query for '.' (the root).
A typical invocation of dig looks
like:
dig @server [options] name type
[class] [+queryopt]dig resolves that name before querying
that name server. If no server argument is provided,
dig will try each of the servers listed in
resolv.conf(5). If no
usable addresses are found, dig will send the
query to the local host. The reply from the name server that responds is
displayed.-t. The
default is A.-c. The default
is IN.The options are as follows:
-4-6-b
sourceaddr[#port]-c
classIN; other
classes are HS for Hesiod records and
CH for Chaosnet records.-f
filedig reads a list of lookup requests to
process from the given file. Each line in the file
should be organized in the same way they would be presented as queries to
dig using the command-line interface.-h-i-k
keyfilekey "keyname" {
algorithm hmac;
secret "base64-secret";
};
keyname is the name of the key, and
base64-secret is the base64-encoded shared secret.
hmac is the name of the key algorithm; valid
choices are hmac-sha1,
hmac-sha224,
hmac-sha256,
hmac-sha384, and
hmac-sha512.
-p
port-q
name-t
typeNS or
AAAA). The default query type is
A, unless the -x 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 is required, set the type to
IXFR=N. The incremental zone
transfer will contain the changes made to the zone since the serial number
in the zone's SOA record was N.
All resource record types can be expressed as
TYPEnn, where
nn is the number of the type. If the resource
record type is not supported in BIND 9, the result will be displayed as
described in RFC 3597.
-u-v-x
addr-x is
used, there is no need to provide the name,
class and type arguments.
dig automatically performs a lookup for a name
like ‘94.2.0.192.in-addr.arpa’ and
sets the query type and class to PTR and
IN respectively. IPv6 addresses are looked up
using nibble format under the IP6.ARPA domain (but see also the
-i option).-y
[hmac:]keyname:secrethmac-sha1,
hmac-sha224, hmac-sha256,
hmac-sha384, and
hmac-sha512. If hmac is not
specified, the default is hmac-sha256.
NOTE: You should use the -k option and
avoid the -y option, because with
-y the shared secret is supplied as a command
line argument in clear text. This may be visible in the output from
ps(1) or in a history file
maintained by the user's shell.
The IN and CH
class names overlap with the IN and CH top level domain names. Either use
the -t and -c options to
specify the type and class, use the -q to specify
the domain name, or use "IN." and "CH." when looking up
these top level domains.
dig 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
and retry strategies.
Each query option is identified by a keyword preceded by a plus
sign (+). Some keywords set or reset an option.
These may be preceded by the string no to negate the
meaning of that keyword. Other keywords assign values to options like the
timeout interval. They have the form
+keyword=value.
Keywords may be abbreviated, provided the abbreviation is unambiguous; for
example, +cd is equivalent to
+cdflag. The query options are:
+[no]aaflag+[no]aaonly.+[no]aaonly+[no]additional+[no]adflag+[no]all+[no]answer+[no]authority+[no]besteffort+bufsize=#+[no]cdflag+[no]class+[no]cmddig and the query options that have been applied
(on by default).+[no]comments+[no]cookie[=value]+cookie is automatically set when
+trace is in use, to better emulate the default
queries from a name server.
This option was formerly called
+[no]sit
(Server Identity Token). In BIND 9.10.0 through BIND 9.10.2, it sent the
experimental option code 65001. This was changed to option code 10 in
BIND 9.10.3 when the DNS COOKIE option was allocated.
The
+[no]sit
option is now deprecated, but has been retained as a synonym for
+[no]cookie
for backward compatibility within the BIND 9.10 branch.
+[no]crypto+[no]defname+[no]search.+[no]dnssec+domain=namedomain directive in
resolv.conf(5), and enable
search list processing as if the +search option
were given (off by default).+[no]edns[=#]+noedns disables EDNS
and clears the remembered version.+ednsflags[=#]+[no]ednsnegotiation+[no]ednsopt[=code[:value]]NSID or ECS), or an
arbitrary numeric value. +noednsopt clears the
EDNS options to be sent.+[no]expire+[no]fail+[no]identify+short option is enabled.+[no]idnoutdig
does not support IDN.+[no]ignore+[no]keepopen+[no]multilinedig output.+ndots=#search or domain directive
in resolv.conf(5) if
+search is set.+[no]nsid+[no]nssearch+[no]onesoaAXFR. This option is off by default, which means
that both the starting and the ending SOA records are printed.+[no]opcode=#QUERY (the default),
IQUERY, STATUS,
NOTIFY, UPDATE, or an
integer number in the range from 0 to 15.+[no]qr+[no]question+[no]rdflag+[no]recurse.+[no]recurse+nssearch or
+trace query options are used.+retry=#+tries, this does not include the initial
query.+[no]rrcomments+rrcomments if +multiline
mode is active or +norrcomments otherwise.+[no]search+ndots, determines
if the name will be treated as relative or not and hence whether a search
is eventually performed or not.+[no]short+[no]showsearch+[no]split=#+nosplit
or +split=0 causes fields not to be split at all.
The default is 56 characters, or 44 characters when
+multiline mode is active.+[no]stats+[no]subnet=addr[/prefix]dig
+subnet=0.0.0.0/0, or simply
dig +subnet=0 for short,
sends an EDNS CLIENT-SUBNET option with an empty address and a source
prefix-length of zero, which signals a resolver that the client's
address information must
not be used when
resolving this query.
+[no]tcpIXFR=N queries use TCP
unless it is explicitly disabled with +notcp.
AXFR queries always use TCP.+timeout=#+[no]traceWhen tracing is enabled, dig makes
iterative queries to resolve the name being looked up. It will follow
referrals from the root servers, showing the answer from each server
that was used to resolve the lookup.
If @server is also specified, it affects only the initial query for the root zone name servers.
+dnssec is also set when
+trace is set to better emulate the default
queries from a name server.
+tries=#+[no]ttlid+[no]vc+[no]tcp
is provided for backwards compatibility. The "vc" stands for
"virtual circuit".+[no]zoneversionThe BIND 9 implementation of dig supports
specifying multiple queries on the command line (in addition to supporting
the -f batch file option). Each of those queries can
be supplied with its own set of flags, options and query options.
In this case, each query argument represent an 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
+[no]cmd
option) can be overridden by a query-specific set of query options. For
example:
dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
shows how dig could be used from the
command line to make three lookups: an ANY query for www.isc.org, a reverse
lookup of 127.0.0.1 and a query for the NS records of isc.org. A global
query option of +qr is applied, so that
dig shows the initial query it made for each lookup.
The final query has a local query option of +noqr
which means that dig will not print the initial
query when it looks up the NS records for isc.org.
P. Mockapetris, Domain Names - Implementation and Specification, RFC 1035, November 1987.
Internet Systems Consortium, Inc.
There are probably too many query options.
| December 27, 2024 | openbsd |