Clearing the DNS query cache under Linux/unix/mac

Source: Internet
Author: User

Under Ms-windows, you can use the ipconfig command to clear the DNS cache. However, Linux and UNIX provide different ways to clear the cache. Linux can run NSCD or BIND or DNSMASQ as the name Service cache daemon. Large or workgroup servers may use bind or DNSMASQ as a dedicated cache server to speed up queries.

650) this.width=650; "src=" Http://www.linuxprobe.com/wp-content/uploads/2017/07/linux-unix-mac-dns02.jpg "alt=" in Linux/unix/mac Clear DNS Query cache under LINUX/UNIX/MAC clear DNS query cache "width=" 302 "height=" 306 "class=" Alignnone size-full wp-image-767 "Title=" under Linux/unix/mac clear the DNS query cache under Linux/unix/mac to clear the DNS query cache "style=" Vertical-align:middle;height:auto;margin : 10px auto; "/>

How to: Clear the NSCD DNS cache

NSCD caches the request for the LIBC initiated name service. If retrieving NSS data is considered slow, NSCD can significantly speed up the continuous access to the same data and improve the performance of the entire system. Simply restart NSCD to refresh the cache:

$ SUDO/ETC/INIT.D/NSCD Restart

Or

# Service NSCD Restart

Or

# service NSCD Reload

This daemon provides a cache for the most commonly used name service requests. The default configuration file,/etc/nscd.conf, determines the behavior of the cache daemon.

Clear the DNSMASQ DNS cache

DNSMASQ is a lightweight DNS, TFTP, and DHCP server. It is designed to provide paired DNS and DHCP services to the LAN. DNSMASQ accepts DNS queries and answers them from a small local cache or forwards them to a true recursive DNS server. The software is also installed on many inexpensive routers to cache DNS queries. Simply restart the DNSMASQ service to clear the DNS cache:

$ SUDO/ETC/INIT.D/DNSMASQ Restart

Or

# Service DNSMASQ Restart

Clear the DNS cache for the BIND cache server

A bind cache server obtains information from a query from another server (Zone Master) response host, and then saves (caches) the data locally. All you have to do is restart bind to clear its cache:

#/etc/init.d/named Restart

You can also use the following RNDC command to clear all caches:

1.# RNDC Restart

Or

1.# RNDC exec

BIND v9.3.0 and above supports a command that clears all record caches for a specific domain name: RNDC flushname. In this example, all records for cyberciti.biz related fields are refreshed:

# RNDC Flushname cyberciti.biz

You can also clear bind View. For example, LAN and WAN view can be cleared with the following command:

1.# RNDC flush lan2.# RNDC Flush Wan

Tips for users of Mac OS X Unix

Under Mac, enter the following command with the root user:

1.# Dscacheutil-flushcache

Or

$ sudo dscacheutil-flushcache

If you are using OSX 10.5 or earlier, try the following command:

Lookupd-flushcache

A hint about the/etc/hosts file

/etc/hosts is used as a table for static query hosts. You need to remove and/or update it according to your requirements under UNIX-like operating systems:

1.# vi/etc/hosts

Example output:

127.0.0.1 localhost2.127.0.1.1 wks01. wag160n wks013.# The following lines is desirable for IPv6 capable hosts4.::1 ip6-localhost ip6-loopback5.fe00::0 I     p6-localnet6.ff00::0 ip6-mcastprefix7.ff02::1 ip6-allnodes8.ff02::2 ip6-allrouters9.10.37.34.2 build10.192.168.1.10 nas0111.192.168.1.11 nas0212.192.168.1.12 nas0313. #192.168.2.50 nfs2.nixcraft.net.in NFS21  4. #192.168.2.51 nfs1.nixcraft.net.in nfs115.172.168.232.50 nfs1.nixcraft.net.in nfs116.172.168.232.51 Nfs2.nixcraft.net.in nfs217.192.168.1.101 VM01


Clearing the DNS query cache under Linux/unix/mac

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.