|
I use a dial-up connection on Linux, and frequent disconnections cause DNS issues. How to clear DNS cache using shell commands on various Linux/Unix distributions? On MS-Windows, you can use theipconfig command to clear DNS cache. However, Linux and Unix provide different methods. Linux can run nscd, BIND, or dnsmasq as name service caching daemons. Large or workgroup servers may use BIND or dnsmasq as dedicated caching servers. How To: Clear nscd DNS CacheNscd caches name service requests from libc. If NSS data retrieval is slow, nscd can significantly speed up repeated access and improve system performance. Restart nscd to clear the cache:
or
or
This daemon caches the most common name service requests. /etc/nscd.conf controls its behavior. Clear dnsmasq DNS Cachednsmasq is a lightweight DNS, TFTP, and DHCP server designed for LANs. It accepts DNS queries and answers from a local cache or forwards to a recursive DNS server. It is also installed on many cheap routers to cache DNS queries. Just restart the dnsmasq service to clear the DNS cache:
or
Clear BIND Cache Server DNS CacheA BIND caching server gets information by responding to queries from another server (zone master) and caches data locally. Restart BIND to clear its cache:
You can also use the rndc command to clear all cache:
or
BIND v9.3.0+ supports clearing cache for a specific domain: rndc flushname. This example flushes cyberciti.biz records:
You can also clear BIND Views. For example, clear LAN and WAN Views:
Tip for Mac OS X Unix UsersRun the following command as root on Mac:
or
If using OS X 10.5 or earlier, try:
A Tip about /etc/hosts/etc/hosts serves as a static lookup table. Modify it as needed on Unix-like systems:
Sample output:
ReferencesRelated: Using ipconfig to clear DNS cache on Windows Vista/XPClear DNS Cache via: http://www.cyberciti.biz/faq/rhel-debian-ubuntu-flush-clear-dns-cache/ |
