1. Clear DNS cache in Linux
There are two methods to implement DNS caching in Linux:
One is to use DNS CacheProgramNscd (Name Service cache Daemon) is responsible for managing DNS cache.
One way to implement DNS caching is to use bind to set up the caching name server.
To clear the cache on nscd, restart the nscd service to clear the DNS cache. Run the following command:
# Service nscd restart
Or
#/Etc/init. d/nscd restart
To clear the cache on the BIND server, run the following command:
# Rndc flush
If your DNS server is implemented using dnsmasq, run the following command:
$ Sudo/etc/init. d/dnsmasq restart
Note: dnsmasq is a lightweight and easy-to-use DNS service tool that can be used for Nat translation of IP addresses during Intranet and Internet connections, or for DNS services in small networks.
Ii. How to clear the DNS cache in other operating systems
1. How to clear DNS in Microsoft Windows:
You can use the following command to clear the DNS cache content.
Ipconfig/flushdns
You can also use the following command to view the DNS cache content.
Ipconfig/displaydns
In Windows, the DNS cache is controlled by the DNS client background process. You can disable it in the control panel> service,
In this way, no DNS cache will be performed for Windows, and the DNS server will be directly queried each time.
2. How to clear the DNS cache in Mac OSX:
In Mac OSX, you can use the following command to clear the DNS cache content:
Bash-2.05a $ lookupd-flushcache
Iii. Other DNS Cache tips
Q: How to view the bind dns server cache:
A: In BIND 9, you can use the rndc-dumpdb command to view DNS Cache. Of course, you must configure rndc first. This command will generate the named_dump.db file in the/var/named (this directory is specified in the named. conf file) directory.
In bind8, try kill-int named_pid.
Q: How to set the DNS Cache Time:
A: In bind9, use the TTL parameter to set the default DNS Cache Time, but remember that this is the cache time of your resolved domain name in others' DNS.
Q: How to clear the DNS cache on the client:
A: In UNIX, the DNS Client is only a few routines that are responsible for forwarding and receiving query functions and are not cached.
Q: How to clear the DNS cache on the DNS server:
A: The simplest method is to restart the named process. Of course, there is also a method that does not need to be restarted: rndc flush