Clear DNS Cache records

Source: Internet
Author: User
Tags dns names

Original link http://www.linuxfly.org/post/543/

 

To improve the DNS resolution record, Many operating systems will provide the cache DNS record function, but this may cause trouble to test the DNS service or domain name settings. To test accurate results, we need to force refresh the local DNS Cache records. The operation instructions on Windows and Linux clients are provided here.

I. Windows Client
In Windows 2000 and later versions, the DNS Client Service is automatically started by default. This service provides the client name resolution and cache service. Your DNS query results are cached locally. The following describes the service:

Reference the DNS Client Service (dnscache) cache Domain Name System (DNS) Name and register the complete computer name of the computer. If the service is stopped, the DNS name will be resolved. However, the query results of DNS names are not cached and computer names are not registered. If this service is disabled, any service explicitly dependent on it cannot be started.

You can use the following command to obtain the DNS results in the cache:

Ipconfig/displaydns

The following command can forcibly clear these DNS caches:

Ipconfig/flushdns

If you find the DNS Client Service troublesome, you can stop it on the control panel-service, or use the following command to stop the service:

Net stop Dnscache

Restart the service:

Net start Dnscache

Ii. Linux Client
Take Hongqi Asianux 3.0 as an example to provide a local DNS Cache service called nscd. However, unlike windows, this service is disabled by default:

Reference # chkconfig -- list | grep nscd
Nscd 0: Close 1: Close 2: Close 3: Close 4: Close 5: Close 6: Close

In addition to providing DNS cache, this service can accelerate NIS. The following describes nscd:

Reference nscd caches name service lookups and can dramatically improve performance with NIS +, and may help with DNS as well.

To activate the local DNS cache, start the service:

# Service nscd start

Similarly, disabling this service can avoid DNS Cache problems:

# Service nscd stop

Note that the service does not provide a command to forcibly Delete the cached results. However, we can clear the cache by deleting the background database record information:

# Rm/var/DB/nscd/hosts
# Service nscd restart

Iii. Linux bind Service
Sometimes, our client is behind a DNS Cache Server. Generally, as a Linux Server of NAT gateway, the bind Service provides DNS caching and forwarding functions. This can be achieved by configuring/etc/named. conf and adding forward:

Reference options {
Directory "/var/named ";
Dump-file "/var/named/data/cache_dump.db ";
Statistics-file "/var/named/data/named_stats.txt ";
Forward only;
Forwarders {
202.96.128.86;
202.96.134.20;
};

};

In this case, the client's external DNS resolution results will be retained on the gateway server in addition to the local DNS cache of the client. Another case is that when we modify the DNS service provided by named, we also need to refresh the cache.
The rndc Command provided by BIND can clear the cache:

# Rndc flush

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.