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 Code | Query Type |
---|---|
A | Host Address |
NS | Authoritative name server |
MD | Mail destination |
MF | Mail forwarder |
CNAME | Canonical name for an alias |
SOA | Start of a zone of authority |
MB | Mailbox domain name |
MG | Mail group member |
MR | Mail rename domain name |
NULL | Null RR |
WKS | Well known service description |
PTR | Domain name pointer |
HINFO | Host information |
MINFO | Mailbox or mail list information |
MX | Mail exchange |
TXT | Text strings |
AXFR | Transfer of an entire zone |
MAILB | Mailbox-related records |
MAILA | Mail agent RR |
ANY | All 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 options | Description |
---|---|
-b address | Sets the source of the IP address of the query. The IP has to be a valid addresson the host's network. |
-c class | To specify the class, such as IN for internet, HS for Hesiod or CH for CHAOSNET records. |
-f file | Operate the command in batch mode by reading the specified file. |
-k file | Specifies a TSIG key to sign the DNS queries. |
-p port_number | Queries a non-standard port number. |
-q name | Sets the query name to the name parameter value specified. |
-t type | Sets the query type. |
-x address | Shortcut for reverse lookup. |
-y [hmac:] | specify named base64 TSIG key |
-4 | Use the IPv4 query transport. |
-6 | Use 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}
:
Parameters | Description |
---|---|
+[no]aaflag | Set AA flag in query |
+[no]aaonly | Set AA flag in query |
+[no]additional | Control display of additional section |
+[no]adflag | Set AD flag in query |
+[no]all | Set or clear all display flags |
+[no]answer | Control display of answer section |
+[no]authority | Control display of authority section |
+[no]badcookie | Retry BADCOOKIE responses |
+[no]besteffort | Try to parse even illegal messages |
+bufsize[=###] | Set EDNS0 Max UDP packet size |
+[no]cdflag | Set checking disabled flag in query |
+[no]class | Control display of class in records |
+[no]cmd | Control display of command line global option |
+[no]comments | Control display of packet header and section name comments |
+[no]cookie | Add a COOKIE option to the request |
+[no]crypto | Control display of cryptographic fields in records |
+[no]defname | Use search list |
+[no]dnssec | Request 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]ednsnegotiation | Set EDNS version negotiation |
+ednsopt=###[:value] | Send specified EDNS option |
+noednsopt | Clear list of
+ednsopt options |
+[no]expandaaaa | Expand AAAA records |
+[no]expire | Request time to expire |
+[no]fail | Don't try next server on SERVFAIL |
+[no]header-only | Send query without a question section |
+[no]identify | ID responders in short answers |
+[no]ignore | Don't revert to TCP for TC responses. |
+[no]keepalive | Request EDNS TCP keepalive |
+[no]keepopen | Keep the TCP socket open between queries |
+[no]mapped | Allow mapped IPv4 over IPv6 |
+[no]multiline | Print records in an expanded format |
+ndots=### | Set search NDOTS value |
+[no]nsid | Request Name Server ID |
+[no]nssearch | Search all authoritative nameservers |
+[no]onesoa | AXFR prints only one soa record |
+[no]opcode=### | Set the opcode of the request |
+padding=### | Set padding block size. Default value = [0] |
+[no]qr | Print question before sending |
+[no]question | Control display of question section |
+[no]raflag | Set RA flag in query |
+[no]rdflag | Recursive mode |
+[no]recurse | Recursive mode |
+retry=### | Set number of UDP retries. Default value = [2] |
+[no]rrcomments | Control display of per-record comments |
+[no]search | Set whether to use a search list |
+[no]short | Display nothing except short form of answers - global option |
+[no]showsearch | Search with intermediate results |
+[no]split=## | Split hex/base64 fields into chunks |
+[no]stats | Control display of statistics |
+subnet=addr | Set edns-client-subnet option |
+[no]tcflag | Set TC flag in query |
+[no]tcp | TCP mode |
+timeout=### | Set query timeout. . Default value = [5] |
+[no]trace | Trace delegation down from root [+dnssec] |
+tries=### | Set number of UDP attempts. Default value = [3] |
+[no]ttlid | Control display of TTLs in records |
+[no]ttlunits | Display TTLs in human-readable units |
+[no]unexpected | Print replies from unexpected sources default=off |
+[no]unknownformat | Print RDATA in RFC 3597 "unknown" format |
+[no]vc | TCP mode |
+[no]yaml | Present the results as YAML |
+[no]zflag | Set 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