How can I flush the DNS on Ubuntu 17.04?
I seem to have a few DNS issues at the moment since upgrading to 17.04 from 16.10 and went to flush the DNS but I can't find how to.
Can anyone tell me please?
How can I flush the DNS on Ubuntu 17.04?
I seem to have a few DNS issues at the moment since upgrading to 17.04 from 16.10 and went to flush the DNS but I can't find how to.
Can anyone tell me please?
You may use this command: sudo systemd-resolve --flush-caches
To verify that flush was sucessfull, use:
sudo systemd-resolve --statistics
Sample output:
Cache
Current Cache Size: 0
Cache Hits: 101
Cache Misses: 256
sudo systemd-resolve --flush-caches
, I get systemd-resolve: unrecognized option '--flush-caches'
.
Commented
Jan 19, 2018 at 17:35
This command should restart the local name service and flush the local DNS cache:
systemctl restart systemd-resolved.service
There is probably a way of getting it to just flush the cache instead of restart, but restart suited my purposes.
--statistics
immediately after. On Ubuntu 18
Commented
Oct 12, 2018 at 19:45
I made this: https://github.com/dunderrrrrr/dnscache
Maybe thats what youre looking for.
Installation
$ git clone [email protected]:dunderrrrrr/dnscache.git
$ cd dnscache/
$ sudo cp dnscache /usr/local/bin/
$ sudo chmod +x /usr/local/bin/dnscache
Usage
There are two arguments that can be passed to the script, clear or stats. Both of them should be self explanatory.
$ sudo dnscache clear
DNS cache has been cleared!
[...]
Cache
Current Cache Size: 0
[...]
systemd-resolve --flush-caches
then systemd-resolve --statistics
. : github.com/dunderrrrrr/dnscache/blob/master/dnscache
Commented
Jun 28, 2018 at 15:00