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 @184.108.40.206
Based on my understanding, after the resolution process, the following records will be cached at this public resolver(220.127.116.11)
example.com. 17834 IN NS a.iana-servers.net. example.com. 17834 IN NS b.iana-servers.net. example.com. 18662 IN A 18.104.22.168
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 @22.214.171.124
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?
- 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)?
- Or, would it recursively resolve (sub.example.com) starting from the root and totally ignores any previous cache for (example.com)?