I am trying to figure out a few things about DNS Client caching. Specifically, I'd like to know how many name servers for a particular domain are cached when the client resolves a record for the first time, and what happens if the cached name server becomes unavailable when future requests are made. Also, is there a way to display the NameServers in a client cache on a windows servers. ipconfig/displaydns only seems to display the cached A and CNames, not the NameServers.

  • 1
    TTL and the relevant RFCs are your friend. – user9517 Jan 30 '15 at 22:35
  • As @HopelessN00b stated in his answer, a DNS client doesn't query for nor cache name server records (AFAIK). That's the job of a DNS server. The DNS server will cache name server records in its DNS server cache. – joeqwerty Jan 30 '15 at 22:52

Name servers are not cached. The records they provide are.

Name servers are assigned on a per-connection basis. In Windows, here are typically two name servers assigned to each network connection, though the upper bound for how many can be assigned is much larger. The configured DNS servers are tried in order - the first one is queried first, if it is unavailable, the second one will be queried, and so on.

ipconfig /all will display a connection's currently configured nameservers, as will going into the connection properties through the GUI, but you will not be able to find a "nameserver cache" because one doesn't exist.

enter image description here

| improve this answer | |
  • Thanks for the response. That provides more clarity for the answer I am seeking. To properly phrase my question, I'd like to know how many nameservers are cached in the upstream DNS resolver from my windows client. For example, if my windows client is using DNS server, and I query for foobar.com, which has 10 authorative name servers, how many of those authorative name servers will be cached on when it resolves the address for me? – Navis Feb 2 '15 at 19:18
  • @Navis None. Name servers are not cached. The records they provide are. – HopelessN00b Feb 2 '15 at 19:32
  • @HopelessNoob I think you are mistaken, I have learned that NS records are indeed not cached at the client, but in fact ARE cached on DNS resolver servers.. Here is an except from rfc1034 6.3.3. Get the host address of poneria.ISI.EDU This request would translate into a type A request for poneria.ISI.EDU. The resolver would not find any cached data for this name, but would find the NS RRs in the cache for ISI.EDU when it looks for foreign servers to ask. Using this data, it would construct a SLIST of the form: – Navis Feb 3 '15 at 20:22

Servers are not cached. Each DNS record (DNS-to-IP assignment) has a TTL (Time-To-Live) attribute (in seconds). So when you first connect server by name, you ask DNS server to provide IP address for DNS name, you get this DNS-to-IP assignment record cached by OS for some time (depends on this record's TTL). Also the time when you got this record from DNS stored in cache and this record's TTL.

If you connect again, OS checks if previous request was more than TTL seconds ago.

  • If TTL passed, OS clears cache record for this DNS-to-IP assignment and requests DNS server again
  • If TTL is not passed yet, OS returns DNS-to-IP assigned from cache.

You can force OS to forget all cached DNS-to-IP assignments using ipconfig /flushdns

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.