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.

中文说明:域名解析成功不代表网站一定可访问;DNS 只负责提供记录答案,后续仍需建立网络连接并完成 TLS/HTTP。

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

ResultMeaning / next check
NXDOMAINName does not exist according to that DNS view; check spelling and zone records.
SERVFAILResolver could not complete resolution; investigate delegation, authoritative DNS and DNSSEC.
REFUSEDServer refused the query; check policy and whether recursion is allowed.
TimeoutCheck 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.