keepcalculator

06 Numbers and Powers

DNS Cache & Root Servers Explained

Card No. 06·6037 · Updated · Standard formula, shown below

This guide explains how DNS caching and root servers work together to turn domain names like example.com into IP addresses. You’ll learn the step-by-step resolution process, what happens at each layer, and how caching speeds up repeat visits. No special tools are required—just a basic understanding of networks.

What You’ll Need

  • A computer or mobile device with internet access (to test commands if you like).
  • Optional: a terminal/command prompt for checking DNS with tools like nslookup or dig (built into most OSes).

Step-by-Step

  1. Understand the DNS hierarchy. DNS is a distributed database. At the top are 13 root server clusters (named A through M), operated by various organizations. They don’t know every domain; they only know where the top-level domain (TLD) servers are (e.g., .com, .org, .net).
  2. Know the resolver’s role. Your device uses a DNS resolver (usually provided by your ISP or a public service like 8.8.8.8). The resolver is the “client� that performs the lookup on your behalf. It starts by checking its own cache.
  3. Check the local cache first. When you type a domain, the resolver looks in its cache for a previously stored answer. If found and not expired, it returns the IP immediately—no further queries. This is DNS caching at work.
  4. If not cached, query a root server. The resolver sends a query to one of the root servers (e.g., 198.41.0.4 for A). The root server does not know the IP for example.com, but it responds with a referral: “I don’t know, but the .com TLD servers are at these IPs.�
  5. Query the TLD server. The resolver then asks a .com TLD server (e.g., a.gtld-servers.net). The TLD server also doesn’t know the final IP, but it refers the resolver to the authoritative name servers for example.com (e.g., ns1.example.com).
  6. Query the authoritative name server. The resolver sends a final query to the authoritative server for the domain. This server holds the actual DNS records (A, AAAA, MX, etc.). It returns the IP address for example.com.
  7. Cache the response. The resolver stores the answer in its cache, along with a Time-to-Live (TTL) value (in seconds) set by the domain owner. The TTL tells the resolver how long to keep the record before checking again.
  8. Return the IP to your device. The resolver sends the IP back to your browser, which then connects to that IP to load the website. Subsequent visits within the TTL will be served directly from the cache, skipping steps 4–6.

Common Mistakes

  • Confusing root servers with authoritative servers. Root servers only point to TLD servers; they never provide the final IP for a domain.
  • Assuming caching is permanent. Cached records expire after the TTL. If you change your website’s IP, old cached data may persist until the TTL elapses.
  • Ignoring negative caching. If a domain doesn’t exist, resolvers also cache the “not foundâ€� response (NXDOMAIN) for a short time, which can delay seeing a newly registered domain.
  • Thinking there are only 13 root servers physically. There are 13 logical names, but each is backed by many physical servers worldwide using anycast.

Tips

  • Use online tools like DNS Checker to see how DNS looks from different locations.
  • If you’re troubleshooting, flush your local DNS cache first (e.g., ipconfig /flushdns on Windows, sudo dscacheutil -flushcache on macOS).
  • Check TTL values with dig example.com (look at the “ttlâ€� column) to understand how long a record will be cached.
  • For website changes, lower the TTL before making changes so the new IP propagates faster, then raise it back later.

Troubleshooting

  • Website doesn’t load after changing DNS: Wait for TTL to expire or manually flush your resolver’s cache. If using a public DNS, you can’t flush it, so you’ll just have to wait.
  • “DNS server not respondingâ€� error: Check your network connection, restart your router, or temporarily switch to a public DNS like 8.8.8.8.
  • Incorrect IP returned: Use nslookup to see which server is answering. If it’s a cache, the TTL may not have expired. If it’s the authoritative server, check your DNS records.
  • Slow DNS resolution: Try a different DNS provider. Some ISPs have slow resolvers. You can also test with dig to measure query time.
  • Domain shows “NXDOMAINâ€� but it exists: This is often negative caching. Wait a few minutes or check with a tool that queries authoritative servers directly.

Frequently Asked Questions

What is the difference between a DNS cache and a DNS resolver?

A resolver is the software/service that performs DNS lookups. The cache is a temporary storage within the resolver that remembers previous answers to speed up future queries.

How long does DNS caching last?

It depends on the TTL set by the domain owner. TTLs can range from seconds (e.g., 300) to days (e.g., 86400). After the TTL expires, the resolver must re-query.

Why are there only 13 root servers?

The number 13 is a limit due to the size of DNS messages over UDP. Each root server is actually a cluster of many machines using anycast, so the physical count is much higher.

Can I bypass DNS caching?

You can’t bypass the resolver’s cache, but you can query a different resolver (e.g., change your DNS settings) or use tools that query authoritative servers directly.

What happens if a root server goes down?

Due to anycast and redundancy, the system is highly resilient. A single root server failure would be transparent to users because other mirrors handle the traffic.

Does DNS caching affect website changes?

Yes. If you change your website’s IP, visitors may still see the old IP until the old cached record expires. That’s why lowering TTL before changes is recommended.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →