Today, under the Linux server encountered a strange problem: The network domain name ping results and nslookup results inconsistent, the resolution process is recorded as follows.
Confirm that the/etc/resolv.conf configuration is correct: no problem;
Confirm if additional domain name is added in/etc/hosts: no problem;
Confirm the correct IP address in the domain name server, and colleagues confirm that the intranet domain name has been updated, the results of Ping point to the old ip,nslookup the correct results;
Confirm the local domain name cache service NSCD Status: In the run, restart does not solve the problem, it seems that the cache is still very stubborn;
# Service NSCD Status
NSCD (PID 30993) is running ...
# Service NSCD Restart
stopping NSCD: [OK]
Starting NSCD: [OK]
Google found NSCD cache file cleanup can be cleaned with the following command, run, the problem is resolved.
# ls/var/db/nscd/
Hosts
# NSCD--invalidate=hosts
# Service NSCD Restart
Please refer to https://stijn.tintel.eu/blog/2012/05/10/how-to-really-flush-the-various-nscd-caches for details.
Summarize:
The Linux server will have a domain name cache locally to speed up domain name resolution, and CentOS uses NSCD
Ping generally uses the cached domain name directly, nslookup directly to the Domain name server query
This article is from the "True Self" blog, so be sure to keep this source http://trueray.blog.51cto.com/5818481/1707575
The ping result of the intranet domain name in Linux is inconsistent with the nslookup result