我在笔记本电脑上的 Linux 上工作,我无法使用 URL 访问特定网站,所以我使用sudo /etc/init.d/nscd restart它来清除 DNS 缓存,但 URL 仍然在 Firefox 中抛出“找不到服务器”。我也试过Chrome,它仍然无法正常工作。其他朋友可以看到网页,但我看不到。那么造成这种情况的主要原因是什么?我可以很好地浏览其他网站。
奇怪的是,当我什至尝试该特定 URL 的 IP 地址时,它显示的页面与其他人看到的不同。
我很感激在这个问题上的任何帮助。
除非您不bind小心运行,否则您应该检查nscd位于/etc/nscd.conf.
它将列出保留的缓存。
enable-cache hosts yes
positive-time-to-live hosts 3600
.......
Run Code Online (Sandbox Code Playgroud)
# nscd -?
-g, --statistics Print current configuration statistics
-i, --invalidate=TABLE Invalidate the specified cache
nscd -g
hosts cache:
yes cache is enabled
no cache is persistent
yes cache is shared
211 suggested size
216064 total data pool size
384 used data pool size
600 seconds time to live for positive entries
0 seconds time to live for negative entries
0 cache hits on positive entries
0 cache hits on negative entries
128 cache misses on positive entries
0 cache misses on negative entries
0% cache hit rate
3 current number of cached values
7 maximum number of cached values
2 maximum chain length searched
0 number of delays on rdlock
0 number of delays on wrlock
0 memory allocations failed
yes check /etc/{hosts,resolv.conf} for changes
Run Code Online (Sandbox Code Playgroud)
# nscd -i hosts
这将使缓存无效。
但是,在执行此操作nscd -g
后,重新启动后的主机条目没有更改,nscd它已被刷新。
service nscd restart
hosts cache:
yes cache is enabled
no cache is persistent
yes cache is shared
211 suggested size
216064 total data pool size
0 used data pool size
600 seconds time to live for positive entries
0 seconds time to live for negative entries
0 cache hits on positive entries
0 cache hits on negative entries
0 cache misses on positive entries
0 cache misses on negative entries
0% cache hit rate
0 current number of cached values
0 maximum number of cached values
0 maximum chain length searched
0 number of delays on rdlock
0 number of delays on wrlock
0 memory allocations failed
yes check /etc/{hosts,resolv.conf} for changes
Run Code Online (Sandbox Code Playgroud)
除非您正在运行绑定,否则这是清除缓存的唯一方法,无需查找数据库nscd并将其删除,这可能会导致其他问题。我将遵循 IP 解析的故障排除程序。我在你的问题的评论中概述了一些。
这是一篇非常好的 Linux Journal 文章的链接,关于故障排除网络问题。