Make DNS change regularly and want to flush DNS cache in Ubuntu? Well, this simple tutorial is going to show you how to do it in Ubuntu 20.04, Linux Mint 20, Ubuntu 20.10 via systemd.
1. First open terminal
from system application menu or get into command console for your remote Ubuntu Server.
Then run command:
sudo systemd-resolve --flush-caches
You can then run command to verify that the caches have been emptied:
systemd-resolve --statistics
And you’ll see something that says “Current Cache Size: 0”:
DNSSEC supported by current servers: no Transactions Current Transactions: 0 Total Transactions: 2900 Cache Current Cache Size: 0 Cache Hits: 1526 Cache Misses: 1653 DNSSEC Verdicts Secure: 0 Insecure: 0 Bogus: 0 Indeterminate: 0
2. If you’re running dnsmasq, just run command to restart the service which will also clear the DNS cache:
sudo systemctl restart dnsmasq
And if you want to check out the statistics, run command to dump to system log:
sudo pkill -USR1 dnsmasq
Then consult the system logs via command:
sudo tail /var/log/syslog
That’s it. Enjoy!
Leave a Reply