DIG(1) | BIND9 | DIG(1) |
dig - DNS lookup utility
dig [@server] [-b address] [-c class] [-f filename] [-k filename] [-m] [-p port#] [-q name] [-t type] [-v] [-x addr] [-y [hmac:]name:key] [-4] [-6] [name] [type] [class] [queryopt...]
dig [-h]
dig [global-queryopt...] [query...]
dig is a flexible tool for interrogating DNS name servers. It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried. Most DNS administrators use dig to troubleshoot DNS problems because of its flexibility, ease of use and clarity of output. Other lookup tools tend to have less functionality than dig.
Although dig is normally used with command-line arguments, it also has a batch mode of operation for reading lookup requests from a file. A brief summary of its command-line arguments and options is printed when the -h option is given. Unlike earlier versions, the BIND 9 implementation of dig allows multiple lookups to be issued from the command line.
Unless it is told to query a specific name server, dig will try each of the servers listed in /etc/resolv.conf. If no usable server addresses are found, dig will send the query to the local host.
When no command line arguments or options are given, dig will perform an NS query for "." (the root).
It is possible to set per-user defaults for dig via ${HOME}/.digrc. This file is read and any options in it are applied before the command line arguments.
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 the specify the domain name, or use "IN." and "CH." when looking up these top level domains.
A typical invocation of dig looks like:
dig @server name type
where:
server
If no server argument is provided, dig consults /etc/resolv.conf; if an address is found there, it queries the name server at that address. If either of the -4 or -6 options are in use, then only addresses for the corresponding transport will be tried. 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.
name
type
-4
-6
-b address[#port]
-c class
-f file
-i
-k keyfile
-m
-p port
-q name
-t type
-v
-x addr
-y [hmac:]keyname:secret
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 dig command does not use the host name and address resolution or the DNS query routing mechanisms used by other processes running on macOS. The results of name or address queries printed by dig may differ from those found by other processes that use the macOS native name and address resolution mechanisms. The results of DNS queries may also differ from queries that use the macOS DNS routing library.
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]additional
+[no]adflag
+[no]all
+[no]answer
+[no]authority
+[no]besteffort
+bufsize=B
+[no]cdflag
+[no]class
+[no]cmd
+[no]comments
+[no]cookie[=####]
+cookie is automatically set when +trace is in use, to better emulate the default queries from a nameserver.
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 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]dnssec
+domain=somename
+[no]edns[=#]
+[no]ednsflags[=#]
+[no]ednsnegotiation
+[no]ednsopt[=code[:value]]
+[no]expire
+[no]fail
+[no]identify
+[no]idnout
+[no]ignore
+[no]keepopen
+[no]multiline
+ndots=D
+[no]nsid
+[no]nssearch
+[no]onesoa
+[no]opcode=value
+[no]qr
+[no]question
+[no]rdflag
+[no]recurse
+retry=T
+[no]rrcomments
+[no]search
'ndots' from resolv.conf (default 1) which may be overridden by +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]sigchase
+[no]sit[=####]
The +[no]sit is deprecated.
+split=W
+[no]stats
+[no]subnet=addr[/prefix-length]
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]tcp
+time=T
+[no]topdown
+[no]trace
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 nameserver.
+tries=T
+trusted-key=####
If not specified, dig will look for /etc/trusted-key.key then trusted-key.key in the current directory.
Requires dig be compiled with -DDIG_SIGCHASE. This feature is deprecated. Use delv instead.
+[no]ttlid
+[no]vc
The 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.
If dig has been built with IDN (internationalized domain name) support, it can accept and display non-ASCII domain names. dig appropriately converts character encoding of domain name before sending a request to DNS server or displaying a reply from the server. If you'd like to turn off the IDN support for some reason, defines the IDN_DISABLE environment variable. The IDN support is disabled if the variable is set when dig runs.
/etc/resolv.conf
${HOME}/.digrc
delv(1), host(1), named(8), dnssec-keygen(8), RFC1035.
There are probably too many query options.
Internet Systems Consortium, Inc.
Copyright © 2004-2011, 2013-2017 Internet Systems
Consortium, Inc. ("ISC")
Copyright © 2000-2003 Internet Software Consortium.
2018-05-25 | ISC |