The DNS resolver cache stores the history of domain name requests that are performed when accessing network resources via the TCP/IP protocol.

This cache stores:

  • direct queries (matching a host name to an IP address);
  • reverse queries (matching an IP address to a host name).

Thanks to the cache, the local computer does not need to contact external DNS servers every time — queries are processed faster.

Time to Live (TTL)

Each record is stored in the cache until the Time to Live (TTL) parameter, which is set by the source server, expires. TTL is specified in seconds and constantly decreases on the local computer. When the counter reaches zero, the record is deleted from the cache.

To view the current records and their remaining lifetime, you can use a special system command.

When to clear the cache

Sometimes it is necessary to clear the cache before its natural update. This is usually required in situations where:

  • The IP addresses of the servers have changed, but the computer still stores the old records;
  • There has been a DHCP failure, and the DNS cache contains incorrect data.
  • Experienced administrators prepare for such changes in advance: a few weeks before reconfiguring the DNS, they reduce the TTL of the relevant records from several days to several hours. This speeds up the distribution of updated data. After the changes are complete, the TTL is returned to its previous value to reduce the load on the servers.

Ways to fix problems

There are two common methods for solving DNS cache problems:

  • Flush the cache — all records are deleted, and new ones are only created during subsequent DNS requests.
  • DNS re-registration (register) — the system updates all current DHCP leases and re-requests records, updating them in the cache.
  • As a rule, it is sufficient to flush the cache and allow the system to recreate the records as needed. DNS re-registration is used less frequently — in cases where there is suspicion of a DHCP failure or inconsistency in the cache data.