Skip to content

dig +trace for a single name

dig +trace shows the full resolution path from root servers to the authoritative answer in a single command. It’s the go‑to tool for diagnosing where a domain resolves and where the delegation chain may break. Below are the practical details you’ll actually use on the job, without the theory overhead.

Running dig +trace and response structure

The basic invocation:

dig +trace ya.ru

The first line always goes to a root server (.). dig gets a referral — TLD zone NS records. The output structure is stable: each step starts with ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: ..., with flags: qr rd ra on the query side and qr aa on the authoritative response. +trace does not recursively resolve the domain; it follows NS referrals step by step, printing each intermediate answer. If a server does not respond at any step, the output stops at the timeout, and no further steps appear.

FlagMeaning (query)Meaning (response)
qrQuery responseQuery response
rdRecursion desired—
raRecursion available—
aa—Authoritative Answer

From root servers to TLD

At the first stage, dig queries the root servers (a.root-servers.net etc.) for the zone’s NS records. The roots return a set of TLD zones. In the output this appears under the AUTHORITY: section, listing TLDs such as .ru, .com, .org, and so on. If a root server is unavailable (UDP 53 filtered, temporary root outage), dig outputs timeout and the chain breaks at this stage. In practice this happens with aggressive provider filters or root‑infrastructure attacks, but normally roots answer instantly.

From TLD to authoritative nameserver

TLD servers reply with NS records for the specific domain. A typical output line:

ya.ru. 3600 IN NS ns1.yandex.ru.
ya.ru. 3600 IN NS ns2.yandex.ru.

dig uses these addresses for the next query. If TLD has no NS records for the domain, or the domain is not registered, dig returns status: NXDOMAIN at the TLD‑answer stage. A typical mismatch — domain registered but NS records point to unavailable hosts.

From authoritative to A/AAAA record

The final step — query to the authoritative nameserver. Looks like:

;; ANSWER SECTION:
ya.ru. 300 IN A 185.36.XXX.YYY

or for IPv6:

ya.ru. 300 IN AAAA 2a02:XXXX:XXXX::ZZZ

dig +trace stops here, as A/AAAA is the resolution goal. If the authoritative server returns a CNAME, basic +trace often stops at the first record, not following the CNAME chain. For follow‑up use +trace +follow, but notes usually keep the base output since +follow can add extra queries and change the response format.

Where delegation breaks (errors, missing records)

The chain can break at any stage. Typical scenarios:

  • NXDOMAIN — domain does not exist, TLD answers with status: NXDOMAIN.
  • No NS records on TLD — TLD zone lacks NS for the subdomain, dig outputs error: no servers available.
  • Firewall/Rate‑limit — UDP 53 blocked, dig times out; use dig +tcp +trace as fallback.
  • Stale NS — authoritative servers removed/changed, but TLD still points to old addresses. Output: SERVFAIL or empty ANSWER section.

Often combined with other commands for diagnosis:

dig +short ya.ru A
dig +tcp +trace ya.ru

If +tcp works but +trace does not, a UDP filter is in play. If +trace reaches authority but A record is missing — the problem is on the nameserver zone.

Practical examples and typical cases

  • Domain unavailability incident: dig +trace nonexistent-domain-12345.ru returns NXDOMAIN at the TLD line. Action: check registration, NS records in the domain panel.
  • DNS migration: Before switching DNS provider, run dig +trace old-domain.com, record the NS addresses, then update TLD delegation.
  • External DNS audit: Compare dig +trace output with the provider’s documentation. NS‑list differences signal a zone change to investigate.
  • Internal resolution: For .local or corporate zones, +trace may fail without a configured recursing resolver, and dig @internal-resolver internal-name is required.
Warning

Do not rely on dig +trace as the sole source of truth when diagnosing production zones. Recursing resolver cache, local /etc/hosts entries, and DNS‑over‑HTTPS policies can yield diverging results. Always correlate with dig @nameserver and the nameservers’ own logs.

Tip

If you need only the final answer but want to keep the query path visible, use dig +trace +noall +answer combined with awk to extract the last ANSWER SECTION line, while the path remains visible in the full output logs.