DNS resolution, referrals and a typed cache
Trace one typed DNS request across a stub, recursive resolver, referrals and an authoritative answer, then test what a cache can reuse. Application protocols and a URL journey · Computer networks.
You type a host name and expect a connection, but the first question is smaller: which record type did the application ask for, and who is allowed to answer it? Watch one lookup separate those roles before a cache makes the path shorter.
Start with the type before the hop. A DNS question carries a QNAME (the owner name), a QTYPE (the record type requested) and a QCLASS (the class, IN for the Internet class here). The application normally hands that typed question through a stub resolver to a configured recursive resolver. The recursive resolver coordinates cache and upstream work; an authoritative service answers from local zone data. Those are roles in this model, not a claim that every deployment uses one machine per role.
Follow a cold typed DNS question
Read the steps as text
- The first frame names the typed question and shows the app-facing stub bridge; the four lanes are role lanes, not a claim that each is one machine.
- The configured recursive resolver receives the typed request and coordinates upstream work; the application does not choose a root hop.
- The resolver has no usable A answer, so it asks the illustrative root service for a closer delegation.
- The root sends a referral toward the parent service; the arrow is direction, not the requested A answer.
- The resolver follows the root referral and asks the illustrative parent for the child-zone direction.
- The parent returns a second referral toward the child zone; the requested A record is still not present.
- The resolver now asks the authoritative service identified by the closer referral, the role with local zone data.
- The authoritative service returns the requested synthetic A record, giving the resolver an answer to cache and forward.
- The resolver stores the fresh typed result and returns it through the stub to the application.
- The cold path ends with one typed A answer; the stored result can shorten a later identical question while fresh.
The first frame makes the typed question concrete: QNAME=app.example.com., QTYPE=A, QCLASS=IN. The trailing dot marks a fully qualified name in this teaching trace, and A asks for an IPv4 address rather than every fact about the name.
Every record and address here is synthetic documentation data: the trace declares A 192.0.2.44 and uses illustrative referrals. It does not contact live DNS or assert a public delegation. The root-to-parent-to-authoritative sequence is a finite path chosen to show the roles; a real resolver may start elsewhere or combine them.
In the cold case, the recursive resolver has no usable A answer for this question. It asks the illustrative root service, receives a referral toward the illustrative parent service, follows that referral, and receives a second referral toward the illustrative authoritative service. A referral is direction: its delegation data helps the resolver continue, while the requested A record arrives only from the final service in this bounded path.
The authoritative service owns the local zone data used by the model. It returns the requested A record, and the recursive resolver can retain that result subject to its freshness rule before sending the answer back through the stub. The application sees the address; it does not need to know which upstream hop supplied it.
Let the cache remove work
Reuse a valid typed cache entry
Read the steps as text
- The same typed question arrives while the resolver marks its A entry valid; the diagram reserves one local answer.
- The resolver returns the valid A entry to the stub, so no root, parent or authoritative message is needed.
- A cache hit removes upstream work but preserves the typed question and the resolver's coordinating role.
The cold trace left a valid cached A entry at the recursive resolver. The second frame asks the same QNAME, QTYPE and QCLASS, so the typed cache key matches and the resolver can return A 192.0.2.44 directly. The root, parent and authoritative lanes stay idle in this exchange. A cache hit shortens the path; it does not change the question's type or turn the resolver into an authoritative service.
Treat “valid” as a freshness state. In this trace the resolver treats the record as fresh while its TTL (time to live) permits; this lesson does not invent a countdown. Some resolvers can serve expired data as a fallback when refresh fails, a separate policy outside this trace. A resolver can also retain delegation knowledge, so a later miss need not begin with the same first hop. These are reasons to describe this scene as one bounded path rather than a universal DNS itinerary.
Change the type, keep the name
A different type needs different data
Read the steps as text
- Keep the owner name but change QTYPE to MX; the known child route makes the next hop explicit without inventing a root lookup.
- The valid A entry is the wrong type, so the resolver sends an MX query along the already known child route.
- The authoritative service returns the separately declared synthetic MX record, which can now be cached under MX.
- The changed type forced a separate lookup; matching the owner name alone was not enough.
The faded transfer keeps app.example.com. but changes the question to QTYPE=MX. The A entry is still valid, yet it is the wrong typed data. This scene declares a separate synthetic MX 10 mail.example.com. record so the type distinction stays visible; the mail target and priority are teaching data, not a live lookup result.
The recursive resolver therefore treats the MX question as a cache miss even though an A record for the same owner name is present. It asks the illustrative authoritative service for the MX record in this compact transfer. The cache key includes the record type: a correct answer to one question does not silently answer another.
Recap
- Read the typed question first: QNAME, QTYPE and QCLASS define what answer is being sought.
- Separate the stub, recursive resolver, referrals and authoritative zone data so each hop has one job.
- Reuse only a fresh cache entry for the same typed question; a valid A record does not satisfy MX or another type.
What this bounded trace leaves out
Real deployments can use forwarding, a cached closer delegation, private zones, multiple authoritative servers, negative answers and other policies. Those choices can change the first upstream hop or the shape of an error without changing the typed-question boundary taught here. The model stops at resolver roles and record typing so those boundaries remain inspectable.
app.example.com. uses the reserved example.com documentation domain; .com itself is not reserved. The displayed A, MX, mail target and referral messages are explicitly synthetic. A resolver may combine implementation roles, but the conceptual separation helps you say who asked, who referred, who answered and what was cached.
Continue to HTTP requests and HTTPS protection to keep name resolution separate from the application exchange that follows. For a DSA connection, Hash Map Fundamentals gives you the same key-to-value habit: the lookup key includes the detail that decides whether a stored value is reusable.