我有一个旧的Ubuntu16.04 (LTS)安装,今天注意到,ping和curl被告知(我假设是libc ),任何未知主机的IP与本地主机的IP相同(例如"nslookup $(
“查找”和“挖掘”正确地报告了"NXDOMAIN“。
在/etc/nsswitch.conf,我有
passwd: compat
group: compat
shadow: compat
gshadow: files
hosts: files dns
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis
/etc/hosts看起来是这样的:
127.0.0.1 localhost.localdomain localhost
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
/etc/hostname:host1.mydomain.net
(与实际价值不同)
/etc/resolv.conf看起来像:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 213.133.98.98
nameserver 213.133.99.99
nameserver 213.133.100.100
我今天完全糊涂了,当curl https://undefinedhost打印
curl: (51) SSL: certificate subject name (host1.mydomain.net) does not match target host name 'undefinedhost'
只有当我看到ping undefinedhost的输出时,我才开始理解似乎正在发生的事情:
$ ping unknownhost
PING host1.mydomain.net (138.201.175.226) 56(84) bytes of data.
64 bytes from host1.mydomain.net (138.201.175.226): icmp_seq=1 ttl=63 time=0.237 ms
最后,dig的行为也与预期的一样:
$ dig unresolvedhost @213.133.98.98
; <<>> DiG 9.10.3-P4-Ubuntu <<>> unresolvedhost @213.133.98.98
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 28972
有人能弄清楚这可能出了什么问题吗?
发布于 2020-09-06 12:48:10
其解释是存在一个隐式主机名查找域搜索列表,它与我在此机器所在的本地域下配置的通配符子域相结合,例如mydomain.net。
引用man resolv.conf:
搜索列表通常是从本地域名确定的;默认情况下,它只包含本地域名。
我有一个本地绑定服务器正在运行,并且我的域已注册并处于活动状态。我的/etc/bind/local/db.mydomain.net看起来是这样的:
...
@ IN SOA mydomain.net. ....
...
host1 IN A 138.201.175.226
* IN CNAME host1.mydomain.net.
....因此,这种行为是完全正确和预期的。我只是有点困惑。:-)
https://askubuntu.com/questions/1269695
复制相似问题