dig references

References for dig.

The dig command uses the following syntax:

dig [domain] [q-type]    [q-class]   [q-opt]     [global-d-opt]

domain

The [domain] parameter specifies the domain to dig:

dig google.com

q-type

The [q-type] parameter specifies the DNS query type. By default, the query type is A for Host addressspecified.

Here is an example of a command that will dig NS queries for Authoritative name serverin google.com:

dig google.com NS

DNS query types

The list of DNS query types are:

Query CodeQuery Type
AHost Address
NSAuthoritative name server
MDMail destination
MFMail forwarder
CNAMECanonical name for an alias
SOAStart of a zone of authority
MBMailbox domain name
MGMail group member
MRMail rename domain name
NULLNull RR
WKSWell known service description
PTRDomain name pointer
HINFOHost information
MINFOMailbox or mail list information
MXMail exchange
TXTText strings
AXFRTransfer of an entire zone
MAILBMailbox-related records
MAILAMail agent RR
ANYAll records

q-class

The [q-class] parameter specifies the class of the query. By default, the query class is IN for Internet.

Other commonly used query classes are HS for Hesiodand CH for CHAOSNETrecords.

Here is an example of a command that specifies the CH class query type:

dig google.com CH

q-opt

The {q-opt} can be used to insert the query options. Multiple query options can be included.

The table below shows the list of options for {q-opt}:

Query optionsDescription
-b addressSets the source of the IP address of the query. The IP has to be a valid addresson the host's network.
-c classTo specify the class, such as IN for internet, HS for Hesiod or CH for CHAOSNET records.
-f fileOperate the command in batch mode by reading the specified file.
-k fileSpecifies a TSIG key to sign the DNS queries.
-p port_numberQueries a non-standard port number.
-q nameSets the query name to the name parameter value specified.
-t typeSets the query type.
-x addressShortcut for reverse lookup.
-y [hmac:]specify named base64 TSIG key
-4Use the IPv4 query transport.
-6Use the IPv6 query transport.

global-d-opt

The {global-d-opt} can be used to insert the global query options. Multiple query options can be included.

The use of {global-d-opt} affect all queries.

The table below shows the list of options for {global-d-opt}:

ParametersDescription
+[no]aaflagSet AA flag in query
+[no]aaonlySet AA flag in query
+[no]additionalControl display of additional section
+[no]adflagSet AD flag in query
+[no]allSet or clear all display flags
+[no]answerControl display of answer section
+[no]authorityControl display of authority section
+[no]badcookieRetry BADCOOKIE responses
+[no]besteffortTry to parse even illegal messages
+bufsize[=###]Set EDNS0 Max UDP packet size
+[no]cdflagSet checking disabled flag in query
+[no]classControl display of class in records
+[no]cmdControl display of command line global option
+[no]commentsControl display of packet header and section name comments
+[no]cookieAdd a COOKIE option to the request
+[no]cryptoControl display of cryptographic fields in records
+[no]defnameUse search list
+[no]dnssecRequest DNSSEC records
+domain=###Set default domain name
+[no]dscp[=###]Set the DSCP value to ### [0..63]
+[no]edns[=###]Set EDNS version
+ednsflags=###Set EDNS flag bits
+[no]ednsnegotiationSet EDNS version negotiation
+ednsopt=###[:value]Send specified EDNS option
+noednsoptClear list of +ednsopt options
+[no]expandaaaaExpand AAAA records
+[no]expireRequest time to expire
+[no]failDon't try next server on SERVFAIL
+[no]header-onlySend query without a question section
+[no]identifyID responders in short answers
+[no]ignoreDon't revert to TCP for TC responses.
+[no]keepaliveRequest EDNS TCP keepalive
+[no]keepopenKeep the TCP socket open between queries
+[no]mappedAllow mapped IPv4 over IPv6
+[no]multilinePrint records in an expanded format
+ndots=###Set search NDOTS value
+[no]nsidRequest Name Server ID
+[no]nssearchSearch all authoritative nameservers
+[no]onesoaAXFR prints only one soa record
+[no]opcode=###Set the opcode of the request
+padding=###Set padding block size. Default value = [0]
+[no]qrPrint question before sending
+[no]questionControl display of question section
+[no]raflagSet RA flag in query
+[no]rdflagRecursive mode
+[no]recurseRecursive mode
+retry=###Set number of UDP retries. Default value = [2]
+[no]rrcommentsControl display of per-record comments
+[no]searchSet whether to use a search list
+[no]shortDisplay nothing except short form of answers - global option
+[no]showsearchSearch with intermediate results
+[no]split=##Split hex/base64 fields into chunks
+[no]statsControl display of statistics
+subnet=addrSet edns-client-subnet option
+[no]tcflagSet TC flag in query
+[no]tcpTCP mode
+timeout=###Set query timeout. . Default value = [5]
+[no]traceTrace delegation down from root [+dnssec]
+tries=###Set number of UDP attempts. Default value = [3]
+[no]ttlidControl display of TTLs in records
+[no]ttlunitsDisplay TTLs in human-readable units
+[no]unexpectedPrint replies from unexpected sources default=off
+[no]unknownformatPrint RDATA in RFC 3597 "unknown" format
+[no]vcTCP mode
+[no]yamlPresent the results as YAML
+[no]zflagSet Z flag in query

Help

To print the help page of dig, use:

dig -h

Version

To print the version of dig, use:

dig -v