I have cache enabled in my dnsmasq, because it is fast.
In some situations (for example, with VPN off), dnsmasq caches wrong results. I want a quick way to clean the cache (when I connect to the VPN for example). Restarting the service works, but it is slow (takes some seconds). I have tried sending SIGHUP, which as expected reloads the configuration, but does not flush the cache.
Is there a way to flush the dnsmasq cache without restarting it?
1 Answer
If you add the following to your dnsmasq.conf this will allow you to clear the cache on a reload rather than a restart.
clear-on-reloadThen we you want to clear the cache you trigger a reload..
pkill -HUP dnsmasqYou can check the contents (dumps stats to the log) of the cache with
pkill -USR1 dnsmasq 7