DNS – Caching DNS Servers

  DNS, DNS Theory, Domains and DNS

In addition to authoritative DNS servers, which are the main carriers of information about domains, there is another type of DNS servers – so-called caching servers. Any client that needs to work with domain names would normally always have to send record queries to a number of DNS servers for each part of the domain for the translation of any domain name. However, this is unnecessary because DNS records do not change as often. In addition, the closer we get to the root of the tree, the lower the probability of a change in the records. For example, it is obvious that the list of DNS servers for TLDs will change only once in a very long time and it is useless to constantly ask the root DNS servers about it and burden them or yourself.

Caching DNS servers come into play here as they mediate the entire mechanism of name and IP address translation to individual clients (clients are defined as end users of the Internet – workstations, individual application servers, etc.) and store the continuously acquired data in memory. Continuously means that they do not only store the resulting data (e.g. IP addresses for the required domain names), but also all intermediate results, i.e. identified authoritative servers for all nodes in the path in the tree from the root to the destination.

Another motivation for these DNS servers is the idea that there is a bottleneck between the end user of the Internet and the Internet itself, for example in the form of a dial-up line, where intensive communication with DNS servers around the world should be avoided. Therefore, each ISP provides its customers with a caching DNS server, which takes care of all matters for clients and only the final answer travels to the client.

However, the question arises as to how long caching DNS servers can keep some information in memory. Therefore, a TTL (Time To Live) value is added for each DNS record, which indicates the amount of time that DNS servers can cache the value for. After this time, it is necessary to discard the value in memory and ask the appropriate authoritative DNS servers again.

Interestingly, NS records of the root domain have a TTL of 6 days, NS records for the cz domain have a TTL of 5 hours, NS for cuni.cz 1 day, NS for mff.cuni.cz 8 hours. But, for example, the A record for “www.seznam.cz” has a TTL of only 300 seconds, i.e. 5 minutes.

When deciding on the TTL setting, two conflicting requirements must be taken into account – to ensure that queries have to be executed as little as possible and, on the other hand, that they spread around the world as soon as possible if a new record value changes. It is therefore necessary to consider the probability that the records will change.