At what point do the NS records defined at the apex of a zone are queried during normal operations?
From what I've researched these records are used by:
DNS NOTIFY, for the master to signal slave servers to pull its SOA and update their zone files when the master changes.
Some tools, to verify the correctness of the DNS zone definitions
Iterative DNS resolvers, if they have cached the authoritative NS records for a zone they will use them to answers queries for that zone instead of going to root/TLD/parent servers
The server itself, to declare itself as authoritative for its zone (though I'm not convinced this is the case, I believe that is set either externally by each DNS implementation plus the parent DNS server referral NS records and not in the zone file, or via the SOA record)
What I don't understand is under which circumstances would an iterative DNS resolver ever cache the NS records for a zone unless he receives a query specifically for the NS records of that zone
Let me elaborate. From what I understand when iterative resolver that has an empty cache is given a query for a resource (for example IN A www.example.com.
), it will:
- Query a root DNS server for
IN A www.example.com.
1.1. It will receive an empty Answer section
1.2. Authority section with the NS records for the .com.
zone (these are not authoritative).
1.3. It will cache these non-authoritative NS records (if it is Child Centric non sticky or Parent Centric). Though RFC 2181 says you SHOULD NOT do this.
- Query a TDL
.com.
DNS server forIN A www.example.com.
2.1. Same deal as above but the non-authoritative NS records are for example.com.
- Query an NS server of
example.com.
forIN A www.example.com.
3.1 Receive an authoritative answer for www.example.com.
3.2 It will cache the A record received.
3.3 It will return an answer to the client
At no point during the above exchange did the iterative resolver emitted the query IN NS example.com.
or IN NS .com.
or any other query for the authoritative NS records for any zone. So, from what I gather, unless some client/user of the iterative DNS resolver happens to emit the exact query IN NS example.com.
, the iterative resolver will never cache the authoritative NS records for IN NS example.com.
Is the above the case? or do iterative DNS resolvers implementations fire NS queries for zones for the purpose of caching their authoritative NS records and speed up future queries for the same domain? Or do they only cache authoritative NS records if a client randomly queries the NS records for a zone? Is there even a common or most popular pattern across DNS resolver implementations?
References:
- What is the role of NS records at the apex of a DNS domain?
- When are NS records at the apex of a DNS domain queried?
- https://www.rfc-editor.org/rfc/rfc1034
- https://www.rfc-editor.org/rfc/rfc1035
- https://www.rfc-editor.org/rfc/rfc2181
- https://www.zytrax.com/books/dns/ch8/ns.html
- How is DNS lookup order determined?
- https://stackoverflow.com/questions/57828833/when-following-a-referral-for-an-a-record-in-an-dns-iterative-query-should-the