How to Read dig Output and Trace a DNS Answer
Read dig status, flags, answer and authority sections, then compare a recursive result with the authoritative answer for your domain.
- dns
- dns-tools
- troubleshooting
- guide
Start a DNS investigation with the full dig output. The short form shows a value when one is available. The full response shows what you asked, who answered, and whether the answer came from an authority or a resolver. Those details matter when you have just changed a record or switched nameservers.
Read the response from top to bottom
Suppose you run dig example.test A against a resolver in a test environment and get the following illustrative values. Substitute a name in a domain you manage for a real check. DNS test names do not resolve on the public internet.
| Output | Example | What it tells you |
|---|---|---|
| Header status | status: NOERROR | The server returned a successful DNS response. Check whether the requested type appears in the answer. |
| Flags | qr rd ra | This is a response. The request asked for recursion, and the server says it offers recursion. |
| Question | example.test. IN A | You requested an IPv4 address record for the exact name shown. |
| Answer | example.test. 300 IN A 192.0.2.20 | This answer has a TTL of 300 seconds. For a cached reply, the TTL may be counting down. |
| Server | 192.0.2.53#53 | This is where your copy of dig received the reply. The address need not belong to the authoritative server. |
| Query time | 14 msec | This is the measured time for this query, which may have been answered from a cache. |
RFC 1035 defines the header flags and return codes. In a direct query for a name the server serves, look for aa, the authoritative-answer flag.
Distinguish empty answers from errors
A NOERROR response with no records of the requested type can mean the name exists but the type is missing. For a negative answer, the authority section can contain the zone's SOA record. An empty answer with nameservers in the authority section can instead be a referral. NXDOMAIN reports that a name does not exist. SERVFAIL means the server could not complete the query, and leaves the existence question open.
If you see a CNAME in the answer, read its target before deciding what is missing. Your server may have found the alias and then failed to find the target. RFC 2308 gives examples of negative responses with aliases, referrals, and SOA records.
Check delegation separately from cache
Run dig +trace your-domain.example A, replacing the placeholder with the domain you manage. BIND documents that +trace follows referrals from the root. Look at the last referral before the final answer. If the parent points to old nameservers, first check the registrar's delegation for the domain. If the parent points to your intended nameservers, query one directly with dig @ns.your-provider.example your-domain.example A +norecurse.
A direct authoritative reply that shows the new value while the recursive answer still shows the old one points toward cache or resolver-specific policy. If the authoritative nameservers disagree with one another, check how the zone was deployed. A failed trace from a network that blocks direct DNS is inconclusive. You can still compare results from an approved resolver and the authoritative service through a network that allows the queries.
