37

How is the DNS cache cleared in 22.04?

The method that worked in 20.04:

systemd-resolve --flush-caches

no longer works.

Artur Meinild
  • 31,035

2 Answers2

53

Newer versions of Ubuntu use this syntax (run as root or with sudo):

resolvectl flush-caches 

(This will also work in Ubuntu 20.04.)

Artur Meinild
  • 31,035
17

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
Stanley
  • 301