Can Someone Explain the DNS Layer Clearly?

I understand the basics of DNS, but I’m still confused about how lookups, caching, resolvers, and authoritative name servers work together. I’m looking for a clear DNS explanation that connects each step and helps me troubleshoot common DNS issues.

Don’t treat every DNS failure as “propagation.” Most problems come from cached answers, broken delegation, or querying a different resolver than you think.

Your device normally uses a small “stub resolver.” It asks a recursive resolver, usually operated by your router, ISP, company, or a public DNS service, for the complete answer. If that resolver already has a valid cached answer, it returns it immediately. Otherwise, it follows the chain: a root server points it toward the relevant top-level domain servers, such as those for .com; the TLD server points it toward the domain’s authoritative name servers; and an authoritative server returns the actual record. The recursive resolver caches each referral and answer according to its TTL, then sends the result back to your device.

Authoritative servers hold the DNS data for the domain, but they generally do not perform recursive lookups for users. Recursive resolvers do the chasing and caching. That distinction matters when troubleshooting. If the authoritative server has the correct new record but your normal resolver still returns the old one, you are probably seeing cached data. Changing a record does not force existing caches to forget the previous answer. Negative results such as NXDOMAIN can be cached too, which explains why a name may remain “missing” for a while after you create it.

A useful troubleshooting order is:

  1. Check what your normal recursive resolver returns.
  2. Query the authoritative server directly and compare the answer.
  3. Verify the registrar’s name-server delegation matches the servers hosting the zone.
  4. Check the exact record type, including A, AAAA, CNAME, MX, and TXT.
  5. Follow CNAME chains and make sure the final target resolves.
  6. Pay attention to the error: NXDOMAIN means the name does not exist, SERVFAIL often points to DNSSEC or server problems, and a timeout suggests connectivity, firewall, or an unavailable server.

The commonly missed edge case is that DNS can be correct while the application is still wrong. An old hosts-file entry, browser DNS cache, VPN, split DNS on a company network, IPv6 record, or application-level cache can override or bypass the answer you expected. Compare results from the same machine and network where the failure occurs before assuming the public DNS records are broken.

Compare changing an A record with changing the domain’s name servers: both involve DNS, but they travel through different cached layers. @shadowwolf2011sync is right about separating recursive and authoritative servers, but remember the resolver may cache the delegation from the TLD separately from the final record. That means your authoritative server can show the new A record while some resolvers still ask the old authoritative server. Check the path in order: delegation, authoritative server, requested record, then local or application caches.

The annoying downside is that failed lookups can be cached too. If a resolver asks for a record before it exists and receives NXDOMAIN, it may keep that negative answer for a while. Adding the record afterward does not necessarily make it appear immediately.

The normal path is: your app asks the operating system’s stub resolver, which asks a recursive resolver, often run by your ISP or DNS provider. If that resolver has a valid cached answer, it returns it. Otherwise, it follows referrals from the root to the TLD, then to the domain’s authoritative name server. That authoritative server supplies the requested record, and the recursive resolver caches it according to its TTL before returning it to you.

@shadowwolf2011sync is right that delegation and record data are separate. Changing an A record updates an answer on the current authoritative server. Changing name servers updates the parent delegation, so resolvers may temporarily follow different paths. For troubleshooting, query the authoritative server directly first, then a few recursive resolvers. If those agree but your browser does not, the stale result is probably in the operating system, browser, router, application, or a negative cache rather than the authoritative DNS zone.

The hidden downside is that DNS does not cache “the domain” as one object. It caches individual answers by name and record type, so A, AAAA, MX, and www versus the bare domain can all behave differently at the same moment.

Your app asks the stub resolver a specific question, such as “What is the AAAA record for www.example.com?” The recursive resolver either answers from cache or walks the hierarchy. Root servers only direct it to .com; .com directs it to the domain’s authoritative servers; the authoritative server answers from that domain’s zone. Those referrals and final records each have separate cache lifetimes.

That is why a site may work over IPv4 but fail over IPv6, or why email can fail while the website works. It is also why “DNS works for me” is incomplete unless you know the exact hostname, record type, resolver, and network being tested. @devhacker2609studio’s delegation point fits here too: the resolver can have a fresh record cached from an old authoritative path while separately holding a delegation with a different expiration.

A useful mental model is that the stub asks for an answer, the recursive resolver does the research, and authoritative servers publish facts about zones. Caching can happen between nearly every part of that process, with each cached item expiring on its own schedule.

Expect TTL to be a suggestion, not a guarantee. Plenty of resolvers round it up, cap it, or hold answers longer than the record says, so even after your old TTL ‘expires’ you can still get stale results from someone’s box. The chain everyone laid out above is solid, and @jack_ops nailed the real gotcha that DNS caches per name and type rather than as one domain. What I’d add for actual troubleshooting: don’t just trust dig once. Query the authoritative server a couple times and check the TTL counting down, because a fixed high number that never drops usually means you hit a cache, not the source. Saves you from chasing a ‘propagation’ ghost that’s really just a resolver ignoring your low TTL.

Query the name server with recursion disabled and look for the AA flag before drawing conclusions from the TTL. For example, dig @ns.example.net www.example.com A +norecurse asks that server directly. An authoritative reply normally shows the configured TTL at roughly the same value on every query. A recursive cache usually shows a countdown.

That is why I’d push back slightly on @smartlab5798’s fixed-TTL test. A TTL that does not decrease is not evidence that you hit a cache. It can mean you reached the authoritative source, which is exactly where the TTL gets assigned. Resolver prefetching can make cached TTLs jump upward too, so TTL behavior is useful evidence, not a definitive test.

The lookup itself is easier to understand as two different jobs. Your device asks for the finished answer. The recursive resolver finds that answer, either from its cache or by asking servers in sequence. The authoritative server does not need to know how to find the rest of the internet. It only answers for zones it serves. Root and TLD servers mainly provide directions, while the domain’s authoritative server provides the requested record.

There is a delegation detail that causes some especially confusing failures: glue records. If example.com uses ns1.example.com as its name server, a resolver needs the address of ns1.example.com before it can ask that server about example.com. The parent zone may publish a glue A or AAAA record to break that circular dependency. Broken or stale glue can therefore send resolvers to the wrong server even when the child zone contains perfectly correct records.

A trace such as dig +trace www.example.com is useful for seeing referrals and glue, but it does not reproduce what your normal recursive resolver currently has cached. Use the trace to inspect the hierarchy, a direct nonrecursive query to inspect the authoritative data, and a normal query to inspect the user-facing result. Those are three different views, and treating them as interchangeable creates a lot of false “DNS propagation” diagnoses.

Most DNS lookups never reach a root server. Your stub asks a recursive resolver for the finished answer, and that resolver reuses whatever valid pieces it already has. On a cold lookup, the root only points to the TLD, the TLD points to the authoritative servers, and one of those supplies the record. Each piece expires separately, so the resolver might have the delegation cached but still need a fresh A record. That’s why “propagation” is a misleading term: updates are not pushed across DNS. Old cached answers simply disappear at different times.

DNS stops once it returns an answer; it does not connect you to the website. Think of the stub resolver as the customer, the recursive resolver as the researcher, and authoritative servers as the official records office. The researcher can reuse a cached result or ask the hierarchy for directions until it reaches the official source. After your device receives an IP address, DNS is finished and the browser starts a separate connection using TCP or QUIC, TLS, and HTTP. That boundary matters because a correct DNS answer can still lead to a broken site, and a working site does not prove every DNS record type is correct.