Networking & Infrastructure

How DNS Really Works, from the Root to the Answer

A practical guide to DNS: resolvers versus authoritative servers, common record types, TTL and caching, reading dig output, DoT and DoH, DNSSEC basics and troubleshooting.

Cyber SwiftNode editors4 min read

Key takeaways

  • A resolver walks from the root through the TLD to the authoritative server, then caches the result until the TTL expires.
  • DoT and DoH hide queries from the network path, but only DNSSEC proves the answer is authentic.
  • dig with +trace and @server settles most DNS mysteries in minutes.

Every time you type a web address, a quiet question is asked before the first packet reaches the destination: which IP address does this name point to? The system that answers is the Domain Name System, a distributed phone book the modern internet cannot function without. Understanding it pays off for anyone who works with networks, security or infrastructure.

Resolvers and Authoritative Servers

Two roles must be kept apart. An authoritative server holds the definitive answers for a zone; the records for your domain live on your DNS provider's servers. A resolver acts on behalf of the user: it receives the question, asks other servers when necessary, and returns the answer. Resolvers usually come from your ISP, your organisation or a public service, and your operating system talks only to them.

From the Root to the TLD

When the resolver has no cached answer, it starts at the top of the tree. It asks a root server, which refers it to the servers for the top-level domain, such as com or org. The TLD servers in turn point to the domain's authoritative servers, and those finally supply the answer. No root server knows your website's address; it only knows where to look next.

Record Types You Will Meet

  • A and AAAA: map a name to an IPv4 or IPv6 address.
  • CNAME: makes one name an alias of another; generally not allowed at the zone apex.
  • MX: names the mail servers for a domain, with priorities.
  • TXT: free-form text, used for SPF, DKIM, DMARC and domain ownership checks.
  • NS: lists the authoritative servers for a zone or subdomain.

TTL and Caching

Each record carries a TTL (Time To Live), in seconds, telling resolvers how long they may reuse the answer. A short TTL spreads changes quickly but increases query load; a long TTL is faster and more resilient but slows down corrections. A common practice is to lower the TTL a day or two before a server migration and raise it again once things are stable. So-called DNS propagation is not magic; it is simply caches that have not expired yet.

A Hands-On Walkthrough with dig

The dig tool is the troubleshooter's best friend. Here are some commands and an illustrative answer using the documentation address 192.0.2.10:

# query through your default resolver
dig www.example.com A

# follow the chain from the root servers down
dig +trace www.example.com

# ask a specific resolver, short output
dig @1.1.1.1 example.com MX +short

# reverse lookup
dig -x 192.0.2.10

# illustrative ANSWER SECTION:
# www.example.com.  300  IN  CNAME  web.example.com.
# web.example.com.  300  IN  A      192.0.2.10

The number 300 is the TTL, and you can see the CNAME leading to another name, which then resolves to an A record. If two resolvers disagree, you are usually looking at a stale cache or at authoritative servers that are out of sync.

Privacy and DNSSEC

Classic DNS runs over UDP and TCP port 53 without encryption, so any device on the path can read your queries. DoT (DNS over TLS) encrypts them on port 853, while DoH (DNS over HTTPS) tunnels them inside ordinary HTTPS traffic. Both hide queries from network eavesdroppers, but the resolver still sees everything, so choosing one you trust matters.

DNSSEC solves a different problem: authenticity. Records are digitally signed and a chain of trust runs from the root down to the domain, letting a validating resolver reject forged answers. DNSSEC does not encrypt anything and offers no confidentiality.

A Troubleshooting Checklist

  1. Run dig +trace and confirm the NS records at your registrar are correct.
  2. Ask the same question of two different resolvers and compare.
  3. Check the remaining TTL; you may simply need to wait for the cache to expire.
  4. Flush the local OS and browser caches.
  5. If DNSSEC is enabled, verify that the DS record matches your current keys.
  6. Make sure no CNAME shares a name with other record types.

This article is sample educational content; verify against official sources before making important decisions.