How is the DNS cache cleared in 22.04?
The method that worked in 20.04:
systemd-resolve --flush-caches
no longer works.
Newer versions of Ubuntu use this syntax (run as root or with sudo
):
resolvectl flush-caches
(This will also work in Ubuntu 20.04.)
I’m on a freshly installed 22.04 and this command did not clear whatever DNS cache dig
is using.
– BastiCommentedMar 28, 2023 at 7:30
dig doesn’t have a cache. dig queries a nameserver directly. The nameserver is probably caching things, but dig has no control over that.
– James MooreCommentedDec 13, 2024 at 23:50
For Ubuntu 22.04 users, follow the below command to flush DNS Cache(resolvectl) :
resolvectl flush-caches
To check the cache size run the below command:
resolvectl statistics
source from https://askubuntu.com/questions/1404586/how-to-clear-dns-cache-in-22-04