Centos 7 上的 DNS 解析不再一致(ping 不是 DNS 测试)

Centos 7 上的 DNS 解析不再一致(ping 不是 DNS 测试)

我的 Centos 7 系统已经工作多年了。现在我遇到了一个与 DNS 解析相关的奇怪问题。使用时它按预期工作ping,但当我想使用时它就失败了curl。他们不应该都使用相同的解析器吗?造成差异的原因可能是什么?

# ping homeserver.fritz.box
PING homeserver.fritz.box (192.168.178.52) 56(84) bytes of data.
64 bytes from homeserver.fritz.box (192.168.178.52): icmp_seq=1 ttl=64 time=0.103 ms
64 bytes from homeserver.fritz.box (192.168.178.52): icmp_seq=2 ttl=64 time=0.146 ms
64 bytes from homeserver.fritz.box (192.168.178.52): icmp_seq=3 ttl=64 time=0.098 ms
^C
--- homeserver.fritz.box ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.098/0.115/0.146/0.024 ms
# curl -v http://homeserver.fritz.box
* Could not resolve host: homeserver.fritz.box; Unknown error
* Closing connection 0
curl: (6) Could not resolve host: homeserver.fritz.box; Unknown error
# 

顺便说一句,我在 IP 192.168.178.52 的机器上运行这些命令,但这可能没有意义。

编辑:同时我发现 /etc/hosts 中没有与服务器名称匹配的条目。添加它解决了我的问题,但我仍然不明白为什么 ping 能够解析该名称。我不知道该看什么。

相关内容