Where does Linux store cached DNS

How to view and clear the Bind DNS server cache on Linux

Show cache

A configured Domain Name Service (DNS) server such as Bind may store previously resolved domain names in a local cache. By default, the cached records are saved for 7 days. The cache can be reused for future domain name resolutions. First, let's see how we can view all of the cached domain name resolutions: # rndc dumpdb -cache The above command saves the cache of the binding. If you cannot find this file after running the above command, check your server's configuration files to see the location of the cache dump file. To view cached DNS records simply or the resulting dump file. For example: # grep gnu.org /var/named/data/cache_dump.db gnu.org. 86358 NS ns1.gnu.org. 86358 NS ns2.gnu.org. 86358 NS ns3.gnu.org. ns1.gnu.org. 86358 A 208.118.235.164 ns2.gnu.org. 86358 A 87.98.253.102 ns3.gnu.org. 86358 A 46.43.37.70

clear cache

The following Linux commands will help you if you want to clear your bind server's cache. First empty all cache entries: # rndc flush As soon as you are done, reload bind: # rndc reload server reload successful If after clearing the cache of the binding and reloading the DNS, no DNS queries have occurred, your new cache dump file empty: # rndc dumpdb -cache # cat /var/named/data/cache_dump.db; ; Start view _default; ; ; Cache dump of view '_default' (cache _default); $ DATE 20160824004622; ; Address database dump; ; ; Unassociated entries; ; ; Bad cache; ; ; Start view _bind; ; ; Cache dump of view '_bind' (cache _bind); $ DATE 20160824004622; ; Address database dump; ; ; Unassociated entries; ; ; Bad cache; ; Dump complete

Something like that