12.1.4Advanced Networks and SecurityCore

DNS Hierarchy, Resolvers and Caching

Trace a lookup through the resolver and the DNS hierarchy. Explain what a cached record saves and why changing an address does not instantly erase every previously cached answer.

35 min Video by Craig'n'Dave Protocols, Routing and DNS
58. OCR A Level (H046-H446) SLR11 - 1.3 TCP IP, DNS & protocol layersCurated by Kepler, not produced by us. Watch it before the notes below.
Open on YouTube

Before you start

  • Distinguish a client, recursive resolver, referral and authoritative answer.
  • Calculate expiry from receipt time and remaining TTL under a supplied cache model.

Watch, pause, try

Video by Craig'n'Dave. Focus on the shared OCR explanation’s DNS discussion, then follow Pearson’s written resolver/hierarchy diagram. The primary terminology reference clarifies caching and authoritative roles. The exercises supply an ordinary TTL model and explicit sequential timing; resolution is separate from TCP/TLS establishment and application trust.

Viewing focus: Distinguish client, recursive resolver and authoritative servers

After watching, attempt these questions before opening the answers. You can also use the written lesson below.

After watching 1: A resolver receives an address record at time 10 s with TTL 120 s. The authority changes the record at time 40 s. May the original cached entry answer a query at 100 s, and may that same ordinary entry still be reused at 131 s without refresh? State its remaining TTL at 100.

Show answer and reasoning

The stipulated expiry is time 130. At time 100 the entry has 30 seconds left and can still supply the older cached value under this model; an authoritative change does not retroactively erase every cached copy. At 131 that entry has expired and cannot simply be reused under the ordinary model. Obtaining refreshed information still depends on the actual resolution/failure policy.

After watching 2: For one simplified cache miss, a resolver sequentially obtains a root referral in 8 ms, TLD referral in 12 ms and authoritative answer in 20 ms. Client-to-resolver round-trip delivery adds 2 ms; ignore all other work. Compare total with a usable local resolver cache hit and explain why a root reply need not contain the final address.

Show answer and reasoning

The supplied miss cost is 8+12+20+2=42 ms; the usable cache hit needs only the stipulated 2 ms client/resolver round trip. The root referral identifies where to continue rather than containing every domain’s final address. Cached intermediate information and different paths can change real costs; these are model values, not measured universal DNS latencies or proof of service trust.

What you'll be able to do

  • Distinguish client, recursive resolver and authoritative servers
  • Trace referrals through a simplified hierarchy
  • Explain TTL-based caching and common DNS misconceptions
1

Assign the participants different roles

DNS associates names with typed resource records in a distributed hierarchical namespace. An address lookup can request an A record for IPv4 or AAAA for IPv6; not every DNS record is an address. A domain can have multiple records, and several names can refer to related services. A name is not an immutable numerical address baked into a web page forever.

A client commonly asks a recursive resolver to obtain an answer. That resolver may already hold a usable cached record. Otherwise it follows the hierarchy using referrals, contacting suitable root, top-level-domain and authoritative servers as necessary. A root server is not a database containing every website’s current address, and the client does not necessarily contact every hierarchy level itself for each query.

2

Draw a cache-miss lookup

For a simplified uncached lookup of lab.example, the resolver asks a root server where to find servers for the relevant top-level domain. It then asks a suitable TLD server for the authoritative server for the domain, and asks that authority for the requested record. The answer returns through the resolver to the client. lab.example is a teaching name; the diagram describes roles rather than a live public lookup.

A referral provides information about where to continue, rather than necessarily providing the final requested address. Actual systems can cache intermediate information, follow aliases and handle failures, so a complete successful lookup need not repeat every step in the simplified diagram. Keep question arrows and answer/referral arrows distinct and label the participant answering at each stage.

3

Explain freshness without promising instant updates

A time-to-live (TTL) limits how long a record can be reused from a cache under the ordinary model. If a resolver caches a record at time 0 with TTL 300 seconds, it can reuse it while that entry remains valid; an authoritative update at time 100 does not retroactively erase that cached copy. A later lookup after expiry normally needs refreshed information.

Caching reduces repeated work, latency and load, but can delay observation of a changed record. DNS resolution is also distinct from establishing a TCP/TLS connection and downloading a resource. Getting an address does not prove the service is reachable or trustworthy. Plain DNS by itself should not be described as automatically encrypting every query or proving that the returned application content is safe.

ParticipantSimplified cache-miss role
ClientRequests a record from a recursive resolver
Recursive resolverObtains/caches a usable answer
Root serverRefers towards the relevant TLD
TLD serverRefers towards the domain authority
Authoritative serverAnswers for the relevant authoritative data
Scroll horizontally to see the full code or table.
Cached referrals or answers can shorten later lookups.
4

Work through the problem

Attempt the task before opening its worked response. Record each change of state, explain the rule used, and check the result against the original requirements. Code examples labelled Python 3 use that language’s conventions; pseudocode states its own assumptions.

Example 1A resolver caches an address at time 0 with TTL 300 s. The authority changes it at time 100. Must a query at time 150 see the new address?
1The original cached entry can still be within its TTL.
2An authoritative change does not automatically invalidate every remote cache.
3The client may therefore receive the older still-usable cached value under this model.
Answer
No; explain the valid cached copy rather than promising immediate propagation.
Example 2A learner draws the root server returning every website’s final IP address. Correct the role.
1The root normally supports referrals towards the appropriate top-level-domain servers.
2The resolver continues towards the relevant authority when necessary.
Answer
Show a hierarchy/referral process, with final authoritative records obtained at the appropriate stage.

Common mistakes to avoid

Treating a root server as a complete website-address directory.
Trace referrals to the relevant authority.
Equating DNS resolution with downloading or authenticating the application.
Separate name lookup, connection establishment and application behaviour.

Key takeaways

  • DNS distributes typed records through a hierarchy.
  • Resolvers use referrals and caches to obtain answers.
  • TTL affects freshness; resolution is not a guarantee of application trust.

Explore further

Return to this tomorrow

Close the notes and answer from memory. Revisit any explanation you cannot yet reconstruct.

  • An authoritative update instantly deletes all cached old copies everywhere:
  • Successful name resolution proves the service’s application content is safe:

Test yourself

Answer a few questions, then review anything you missed.

Next step

Keep practising

Start with the quiz above to check the key ideas. You can also choose another topic from the practice library.

Browse practice topics

Related lessons

All 4 lessons