1. Understand the resolution path
A typical lookup uses a stub resolver on the client, a recursive resolver, and authoritative DNS servers. Cached answers may shorten this path. DNS records describe different kinds of data; an A record maps a name to IPv4, AAAA to IPv6, CNAME aliases one name to another, and MX identifies mail exchangers.
2. Query records with dig
dig example.com A dig example.com AAAA dig example.com MX dig example.com NS dig +short example.com A
Use an explicit resolver to compare answers:
dig @1.1.1.1 example.com A dig @8.8.8.8 example.com A
Different answers can be legitimate due to geo-DNS, split-horizon DNS, caching, or propagation. Compare TTL, answer section, authority section and response status.
3. Check delegation and authoritative servers
dig +trace example.com
+trace follows the delegation chain from the DNS root. It can help identify a broken registrar delegation, missing authoritative record or DNSSEC issue. Some networks block direct DNS queries, so interpret timeouts in context.
4. Inspect the local resolver
resolvectl status resolvectl query example.com getent ahosts example.com cat /etc/resolv.conf
On systems using systemd-resolved, resolvectl shows per-link DNS configuration and cache-aware resolution. getent follows the system name-service configuration used by applications.
5. Interpret common failures
| Result | Meaning / next check |
|---|---|
| NXDOMAIN | Name does not exist according to that DNS view; check spelling and zone records. |
| SERVFAIL | Resolver could not complete resolution; investigate delegation, authoritative DNS and DNSSEC. |
| REFUSED | Server refused the query; check policy and whether recursion is allowed. |
| Timeout | Check routing, firewall, UDP/TCP 53 reachability and resolver health. |
6. Avoid premature cache flushing
Record the current answer and TTL before clearing caches. Flush only the relevant resolver cache when you have evidence of stale local data:
sudo resolvectl flush-caches
This affects the local systemd-resolved cache, not public recursive resolvers or authoritative DNS caches.
Checklist
- Query A and AAAA separately.
- Compare the local resolver with a known public resolver.
- Inspect delegation with
dig +trace. - Check TTL and DNSSEC before assuming propagation delay.
References & further reading
Commands are examples for a representative Ubuntu/Linux environment. Review paths, versions, access requirements and maintenance impact before applying them to production systems.