如何解决Debian Buster - 无法从 Windows 以外的其他机器 ping 主机?
我有一个 Debian 10 系统,它只是……似乎不想被访问。系统本身(在我的场景中名为 Hestia)是一个 VM 主机(proxmox)。它可以 ping 所有其他系统,包括它自己的来宾 VM,而且它本身也很好:
root@Hestia:~# ping hestia
PING Hestia (10.1.0.24) 56(84) bytes of data.
64 bytes from Hestia (10.1.0.24): icmp_seq=1 ttl=64 time=0.022 ms
64 bytes from Hestia (10.1.0.24): icmp_seq=2 ttl=64 time=0.030 ms
64 bytes from Hestia (10.1.0.24): icmp_seq=3 ttl=64 time=0.031 ms
但是没有其他 linux 系统可以通过主机名访问它:
[root@Gitlab ~]# ping Hestia.lan
ping: Hestia.lan: Name or service not known
[root@Gitlab ~]# ping Hestia
ping: Hestia: Name or service not known
[root@Gitlab ~]# ping hestia
ping: hestia: Name or service not known
奇怪的是,我可以从任何 Windows 系统正常访问系统,但只能通过 IPv6 获得响应:
ping hestia
Pinging Hestia.local [fe80::aaa1:59ff:fe49:cf27%22] with 32 bytes of data:
Reply from fe80::aaa1:59ff:fe49:cf27%22: time<1ms
Reply from fe80::aaa1:59ff:fe49:cf27%22: time<1ms
我真的不太确定从哪里开始寻找这里。什么会导致这种情况?以及如何修复它以便我的 linux 机器可以通过主机名访问我的服务器?
以下是我认为相关的 conf 文件?
root@Hestia:~# cat /etc/hosts
127.0.0.1 localhost
10.1.0.24 Hestia Hestia.proxmox.com
#127.0.1.1 Hestia.lan Hestia
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
.
root@Hestia:~# cat /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 127.0.0.53
nameserver 10.1.0.1
search lan
domain lan
解决方法
通过主机名访问它的所有其他系统都必须在主机配置中拥有它的 IP:
也许是这样的:
10.1.0.24 hestia.lan
或者您的域名服务器 127.0.0.53、10.1.0.1 必须运行 DNS 服务(如 dnsmasq),其中包含(可能是硬编码的)本地主机名的 DNS 条目。
如果您阅读错误消息 ping: Hestia.lan: Name or service not known
,并不是说它可以将“Hestia.lan”名称解析为 IP 并且该 IP 没有响应。 ping 没有问题,DNS 解析有问题。
可能你的 Windows 机器已经在 c:/windows/system32/etc/hosts 中了?
有时另一个问题是当您的物理网络上有多个逻辑网络时,必须正确配置路由以确保一切正常。但是,当您的 dns 名称解析为 IP,但 IP 没有响应时,需要解决该问题。
执行摘要:您的问题不在于 ping 或 Debian 想要访问,而在于您所有其他主机(或您的路由器,如果您想使用 dnsmasq 路由)的 DNS/主机设置
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。