Clear DNS Cache on Ubuntu 20.04

Clear DNS Cache on Ubuntu 20.04

DNS server is used to translate domain names to specific IP addresses. DNS cache is a temporary storage that contains domain to IP mapping information about websites which recently was visited. It allows to speed up access to visited websites. Sometimes, IP addresses of websites might change. So recommended to clear DNS cache from time to time. This tutorial shows how to clear DNS cache on Ubuntu 20.04.

Current DNS cache size can be checked using the following command:

sudo systemd-resolve --statistics


Current Transactions: 0
  Total Transactions: 8

  Current Cache Size: 4
          Cache Hits: 1
        Cache Misses: 7

DNSSEC Verdicts
              Secure: 0
            Insecure: 0
               Bogus: 0
       Indeterminate: 0

To clear DNS cache, use systemd-resolve command with flush-caches option.

sudo systemd-resolve --flush-caches

Leave a Comment

Cancel reply

Your email address will not be published.