I'm not sure how recursive resolves behave when its cache contains partial of the answer. Specifically, let's assume that first I ran this lookup request:

dig example.com @

Based on my understanding, after the resolution process, the following records will be cached at this public resolver(

example.com.        17834   IN  NS  a.iana-servers.net.
example.com.        17834   IN  NS  b.iana-servers.net.
example.com.        18662   IN  A

Second, let's assume the I ran another lookup request as follows (Before the expiration of the TTL of the above records):

dig sub.example.com @

Now, since the NS records that are needed to resolve the apex domain are already in the cache, does the recursive resolver use this cached information to directly query one of these NS records for the A record for (sub.example.com)? If yes, how does it know how to breakdown the request?

I got the idea of how resolver start starts from the top of the hierarchy, i.e., root (.) if it doesn't have the answer in cache. However, what I found confusing is that if the cache has partial answers (in this example it's the NS record for the apex domain) how does the resolver make use of these cached answers?

  1. Would it breakdown the query (sub.example.com) and identify the apex domain(example.com), then find a hit in the cache for the NS record for (example.com)?
  2. Or, would it recursively resolve (sub.example.com) starting from the root and totally ignores any previous cache for (example.com)?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.