我在我的/etc/hosts文件中解析了几个本地域名到127.0.0.1。一段时间以来一切都很正常,但现在当我运行:
导致的结果是:
有人知道为什么我的
nslookup test.local
导致的结果是:
Server: 192.168.1.3
Address: 192.168.1.3#53
** server can't find test.local: NXDOMAIN
192.168.1.3
是我们的网络 DNS,它不应该知道我的本地域名 test.local
。经过几次搜索,我发现 /etc/nsswitch.conf
文件保存了查询 DNS 源的优先级信息。但是那里没有问题!这是我的配置:
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.
passwd: compat
group: compat
shadow: compat
hosts: files mdns4_minimal [NOTFOUND=return] dns
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
有人知道为什么我的
hosts
文件没有包含在DNS查找中吗?
getent ahosts
而不是ping
,因为前者不需要ping
那样的额外信息。 - Mikko Rantalainengetent
多年来获取用户和组信息,我从未想到它还可以处理DNS。 - colm.anseo