How to empty the DNS cache for Linux

Source: Internet
Author: User

How to empty the DNS cache for Linux

I. Empty DNS cache under Linux

There are usually two ways to implement a DNS cache implementation under Linux:
One is to manage the DNS cache with the DNS cache program NSCD (Name Service cache daemon).
One way to implement DNS caching is to use bind to erect the caching Name server.

If you are clearing the cache on the NSCD, you can restart the NSCD service to achieve the effect of clearing the DNS cache. With this command:
# Service NSCD Restart
Or
#/etc/init.d/nscd restart

If you are clearing the cache on the BIND server, use this command:
# RNDC Flush

If your DNS server is implemented with DNSMASQ, use the following command:
$ SUDO/ETC/INIT.D/DNSMASQ Restart

Note: DNSMASQ is a lightweight, easy-to-use DNS service tool that can be used for IP address NAT translation at the time of intranet and Internet connection, or as a DNS service for small networks.

Second, the method of emptying the DNS cache under other operating systems
1. How to empty DNS under Microsoft Windows:
You can use the following command to empty the contents of the DNS cache.
Ipconfig/flushdns

You can also use the following command to view the contents of the DNS cache.
Ipconfig/displaydns
The DNS Cache under Windows is controlled by the DNS client daemon, and you can turn it off in the services in Control Panel,
This way, Windows does not have a DNS cache and queries DNS Server directly each time.

2. How to empty the DNS cache under Mac OSX:
In Mac OSX, you can use the following command to empty the contents of the DNS cache:
Bash-2.05a$lookupd-flushcache

Third, some other DNS cache tips
Q: How to view the cache for bind DNS server:
A: In Bind 9, you can use the rndc-dumpdb command to view the DNS Cache, of course your RNDC should be configured first. This command generates the Named_dump.db file in the directory/var/named (this directory is specified in the named.conf file).
Under Bind8, you can try Kill-int named_pid.

How to set the Q:dns cache time:
A: In Bind9, use the TTL parameter to set the DNS default cache time, but keep in mind that this is the cache time of the domain name you resolved in someone else's DNS.

Q: How to Empty the DNS Cache on the client:
A: Under UNIX, the DNS client is just a few routines that are responsible for forwarding and accepting query functionality, not caching.

Q: How to Empty the DNS Cache on the DNS server side:
A: The simplest way is to restart the named process, and of course there is no way to restart it: RNDC flush

How to empty the DNS cache for Linux

I. Empty DNS cache under Linux

There are usually two ways to implement a DNS cache implementation under Linux:
One is to manage the DNS cache with the DNS cache program NSCD (Name Service cache daemon).
One way to implement DNS caching is to use bind to erect the caching Name server.

If you are clearing the cache on the NSCD, you can restart the NSCD service to achieve the effect of clearing the DNS cache. With this command:
# Service NSCD Restart
Or
#/etc/init.d/nscd restart

If you are clearing the cache on the BIND server, use this command:
# RNDC Flush

If your DNS server is implemented with DNSMASQ, use the following command:
$ SUDO/ETC/INIT.D/DNSMASQ Restart

Note: DNSMASQ is a lightweight, easy-to-use DNS service tool that can be used for IP address NAT translation at the time of intranet and Internet connection, or as a DNS service for small networks.

Second, the method of emptying the DNS cache under other operating systems
1. How to empty DNS under Microsoft Windows:
You can use the following command to empty the contents of the DNS cache.
Ipconfig/flushdns

You can also use the following command to view the contents of the DNS cache.
Ipconfig/displaydns
The DNS Cache under Windows is controlled by the DNS client daemon, and you can turn it off in the services in Control Panel,
This way, Windows does not have a DNS cache and queries DNS Server directly each time.

2. How to empty the DNS cache under Mac OSX:
In Mac OSX, you can use the following command to empty the contents of the DNS cache:
Bash-2.05a$lookupd-flushcache

Third, some other DNS cache tips
Q: How to view the cache for bind DNS server:
A: In Bind 9, you can use the rndc-dumpdb command to view the DNS Cache, of course your RNDC should be configured first. This command generates the Named_dump.db file in the directory/var/named (this directory is specified in the named.conf file).
Under Bind8, you can try Kill-int named_pid.

How to set the Q:dns cache time:
A: In Bind9, use the TTL parameter to set the DNS default cache time, but keep in mind that this is the cache time of the domain name you resolved in someone else's DNS.

Q: How to Empty the DNS Cache on the client:
A: Under UNIX, the DNS client is just a few routines that are responsible for forwarding and accepting query functionality, not caching.

Q: How to Empty the DNS Cache on the DNS server side:
A: The simplest way is to restart the named process, and of course there is no way to restart it: RNDC flush

How to empty the DNS cache for Linux

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.