HOME

TheInfoList



OR:

dig is a
network administration Network management is the process of administering and managing computer networks. Services provided by this discipline include fault analysis, performance management, provisioning of networks and maintaining quality of service. Network manage ...
command-line A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
tool for querying the
Domain Name System The Domain Name System (DNS) is a hierarchical and distributed naming system for computers, services, and other resources in the Internet or other Internet Protocol (IP) networks. It associates various information with domain names assigned t ...
(DNS). dig (Domain Information Groper) is useful for network troubleshooting and for educational purposes. It can operate based on command line option and flag arguments, or in batch mode by reading requests from an operating system file. When a specific
name server A name server refers to the server component of the Domain Name System (DNS), one of the two principal namespaces of the Internet. The most important function of DNS servers is the translation (resolution) of human-memorable domain names (example ...
is not specified in the command invocation, it uses the operating system's default resolver, usually configured in the file
resolv.conf resolv.conf is the name of a computer file used in various operating systems to configure the system's Domain Name System (DNS) resolver. The file is a plain-text file usually created by the network administrator or by applications that manage ...
. Without any arguments it queries the
DNS root zone The DNS root zone is the top-level DNS zone in the hierarchical namespace of the Domain Name System (DNS) of the Internet. Before October 1, 2016, the root zone had been overseen by the Internet Corporation for Assigned Names and Numbers (ICAN ...
. dig supports
Internationalized domain name An internationalized domain name (IDN) is an Internet domain name that contains at least one label displayed in software applications, in whole or in part, in non-latin script or alphabet, such as Arabic, Bengali, Chinese ( Mandarin, simplif ...
(IDN) queries. dig is a component of the domain name server software suite
BIND BIND () is a suite of software for interacting with the Domain Name System (DNS). Its most prominent component, named (pronounced ''name-dee'': , short for ''name daemon''), performs both of the main DNS server roles, acting as an authoritative ...
. dig supersedes in functionality older tools, such as
nslookup nslookup (from ''name server lookup'') is a network administration command-line tool for querying the Domain Name System (DNS) to obtain the mapping between domain name and IP address, or other DNS records. Overview nslookup was a member of the ...
and the program host; however, the older tools are still used in complementary fashion.


Example usage


Basic

In this example, dig is used to query for ''any'' type of record information in the domain ''example.com'':
$ dig example.com any
; <<>> DiG 9.6.1 <<>> example.com any
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4016
;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;example.com.                   IN      ANY

;; ANSWER SECTION:
example.com.            172719  IN      NS      a.iana-servers.net.
example.com.            172719  IN      NS      b.iana-servers.net.
example.com.            172719  IN      A       208.77.188.166
example.com.            172719  IN      SOA     dns1.icann.org. hostmaster.icann.org. 2007051703 7200 3600 1209600 86400

;; Query time: 1 msec
;; SERVER: ::1#53(::1)
;; WHEN: Wed Aug 12 11:40:43 2009
;; MSG SIZE  rcvd: 154
The number ''172719'' in the above example is the
time to live Time to live (TTL) or hop limit is a mechanism which limits the lifespan or lifetime of data in a computer or network. TTL may be implemented as a counter or timestamp attached to or embedded in the data. Once the prescribed event count or time ...
value, which indicates the time of validity of the data. The ''any'' DNS query is a special meta query which is now deprecated. Sinc
around 2019
most public DNS servers have stopped answering most DNS ''ANY'' queries usefull

If ''ANY'' queries do not enumerate multiple records, the only option is to request each List of DNS record types, record type (e.g. A, CNAME, or MX) individually.


Specific DNS server

Queries may be directed to designated DNS servers for specific records; in this example, MX records:
$ dig wikimedia.org MX @ns0.wikimedia.org
; <<>> DiG 9.11.3 <<>> wikimedia.org MX @ns0.wikimedia.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39041
;; flags: qr aa rd; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1024
; COOKIE: c9735311d2d2fa6e3b334ab01b67960d (good)
;; QUESTION SECTION:
;wikimedia.org.                 IN      MX

;; ANSWER SECTION:
wikimedia.org.          3600    IN      MX      10 mx1001.wikimedia.org.
wikimedia.org.          3600    IN      MX      50 mx2001.wikimedia.org.

;; Query time: 1 msec
;; SERVER: 208.80.154.238#53(208.80.154.238)
;; WHEN: Sat Sep 18 21:33:24 PDT 2021
;; MSG SIZE  rcvd: 108


With output formatting

There are man
output formatting options
available. A common selection to make the output more terse is:
$ dig +noall +answer +multiline wikimedia.org MX
wikimedia.org.          3600 IN MX 10 mx1001.wikimedia.org.
wikimedia.org.          3600 IN MX 50 mx2001.wikimedia.org.
Where ''+noall +answer +multiline'' are simply output formatting flags.


History

dig was originally written by Steve Hotz and incorporated into
BIND BIND () is a suite of software for interacting with the Domain Name System (DNS). Its most prominent component, named (pronounced ''name-dee'': , short for ''name daemon''), performs both of the main DNS server roles, acting as an authoritative ...
4; later it was rewritten by Michael Sawyer, and is maintained by the
Internet Systems Consortium Internet Systems Consortium, Inc., also known as ISC, is a Delaware-registered, 501(c)(3) non-profit corporation that supports the infrastructure of the universal, self-organizing Internet by developing and maintaining core production-quality sof ...
as part of BIND 9. When originally written, the manual page for dig indicated that its name was an acronym for "Domain Information Groper". This expansion was removed in 2017; the tool's name is now simply "dig".


See also

*
BIND BIND () is a suite of software for interacting with the Domain Name System (DNS). Its most prominent component, named (pronounced ''name-dee'': , short for ''name daemon''), performs both of the main DNS server roles, acting as an authoritative ...
name server *
Root name server A root name server is a name server for the root zone of the Domain Name System (DNS) of the Internet. It directly answers requests for records in the root zone and answers other requests by returning a list of the authoritative name servers ...
– top-level name servers providing top level domain name resolution *
List of DNS record types This list of DNS record types is an overview of resource records (RRs) permissible in zone files of the Domain Name System The Domain Name System (DNS) is a hierarchical and distributed naming system for computers, services, and other resou ...
– possible types of records stored and queried within DNS *
whois WHOIS (pronounced as the phrase "who is") is a query and response protocol that is widely used for querying databases that store the registered users or assignees of an Internet resource, such as a domain name, an IP address block or an autonomou ...
* host is a simple utility for performing Domain Name System lookups *
nslookup nslookup (from ''name server lookup'') is a network administration command-line tool for querying the Domain Name System (DNS) to obtain the mapping between domain name and IP address, or other DNS records. Overview nslookup was a member of the ...
, another utility that can be used to obtain similar information


References


Bibliography

* Paul Albitz and Cricket Liu. DNS and BIND, 5th Edition. Nutshell Series. O'Reilly and Associates, Inc., 2006.


External links


Official BIND 9 man page for digHow to use dig to query DNS name serversDig source code in ISC Gitlab repository
{{Unix commands DNS software Domain Name System Free network-related software