dig Reference Guide
Last updated
This document serves as a quick reference for the dig command-line tool, its syntax, and its output. If you are new to dig, start with What Is dig? for an introduction, or view How to Use dig to learn how to use dig.
Basic syntax and options
The basic syntax for a dig command is:
dig [@server] [name] [type] [+options]
-
[@server]: The DNS server to ask. If you leave it out,diguses your system’s resolver. -
[name]: The domain name you want to query (e.g.,dnsimple.com). -
[type]: The record type you want to query (e.g.,A,MX,CNAME). If no type is specified,digqueries forArecords. -
[+options]: Options that change the query or the output.
Common options
-
+short: Returns only the answer, in a concise format. -
@server: Asks a specific DNS server (e.g.,@8.8.8.8for Google Public DNS, or@ns1.dnsimple-edge.comfor a DNSimple name server). -
+trace: Traces the DNS query from the root name servers down to the authoritative servers.
Common queries
-
Query for an A record:
dig dnsimple.com A -
Query for an MX record:
dig dnsimple.com MX -
Query for a CNAME record:
dig www.dnsimple.com CNAME -
Query for all records:
dig dnsimple.com ANY
The ANY query type
An ANY query asks a DNS server for all the records it has for a name. Because ANY queries were used in DDoS attacks, RFC 8482 lets servers answer them with a minimal response instead, and some public resolvers refuse them outright (status NOTIMP). An ANY answer can leave records out, so it does not reliably show everything in your zone.
For troubleshooting, query each record type separately (e.g., A, MX, CNAME). This gives you a complete and reliable answer. If you are experiencing DNS resolution problems, see Troubleshoot Record Resolution Issues or Troubleshoot Domain Resolution Issues for guidance.
Breakdown of a dig response
A standard dig output is divided into several sections:
-
HEADER: Provides information about the query and response, like the status code:
-
NOERROR: The query succeeded. If the ANSWER section is empty, the name exists but has no records of the type you asked for. -
NXDOMAIN: The name does not exist. -
SERVFAIL: The server could not answer, for example because of a DNSSEC validation failure or an unreachable name server.
-
- QUESTION SECTION: Repeats the query, confirming the domain and record type requested.
- ANSWER SECTION: The most important section. This contains the actual DNS records that were found for the query.
- AUTHORITY SECTION: Lists the authoritative name servers for the domain, when the server includes them. Many answers leave this section out.
- ADDITIONAL SECTION: Provides other records that may be relevant to the query, like the IP addresses of the authoritative name servers listed in the AUTHORITY section.
Have more questions?
If you have additional questions or need any assistance troubleshooting your DNS, just contact support, and we will be happy to help. You can also read more about DNS hosting at DNSimple.