Table of Contents

Ubuntu - Networking - DNS - Flush DNS

View the statistics of our DNS cache

resolvectl statistics

returns:

DNSSEC supported by current servers: no
 
Transactions               
Current Transactions: 0    
  Total Transactions: 3554 
 
Cache                      
  Current Cache Size: 0    
          Cache Hits: 13   
        Cache Misses: 84731
 
DNSSEC Verdicts            
              Secure: 0    
            Insecure: 0    
               Bogus: 0    
       Indeterminate: 0

Flush the cache

resolvectl flush-caches

NOTE: This should reduce the Cache Size entry reset to 0.

  • This works for both Ubuntu Server and Ubuntu Desktop.

The Older Method

sudo systemd-resolve --flush-caches

Check the statistics in order to make sure that your cache size is now zero, thus cleared:

sudo systemd-resolve --statistics

returns:

DNSSEC supported by current servers: no
 
Transactions                
Current Transactions: 0     
  Total Transactions: 169902
 
Cache                       
  Current Cache Size: 39    
          Cache Hits: 162   
        Cache Misses: 190   
 
DNSSEC Verdicts             
              Secure: 0     
            Insecure: 0     
               Bogus: 0     
       Indeterminate: 0