我有一个安装了两台虚拟机的 VMware vSphere 虚拟机管理程序。我需要能够从我的客户端(也在同一子网中)访问主机(进行配置等)以及两台虚拟机。我想设置一个 PoC Hadoop 集群,客户端需要连接到所有虚拟机。
昨天,我可以 ping 通主机和其中一台虚拟机,但无法 ping 通另一台。从无法访问的虚拟机 ping 通可访问的虚拟机,以及 ping 通主机(如果我没记错的话)。
今天,我可以 ping 通两个虚拟机,但不能 ping 通主机,而且我没有做任何更改。
这三个都配置了静态 IP,但无法访问的 IP 似乎不属于网络的一部分(可能是 ARP 请求无法到达它或其他原因)。检查客户端上的 ARP 表只是确认无法访问的主机的 IP 有无效条目。我尝试删除无效条目,甚至完全刷新缓存,但无济于事。
我检查了 MAC 地址是否冲突,发现虚拟机和主机的 MAC 都不同。主机名也不同。显然,分配的 IP 也不同。
我考虑过路由器的端口保护,但似乎没有意义,因为同一端口上至少有两个 IP。另外,我无法轻松检查是否已激活该功能,因为我无法访问路由器。
基本网络配置是:
VM Host: 172.16.40.11 ------ Gateway: 172.16.40.1 ----- Client: 172.16.40.22
VM 1: 172.16.40.191 -|
VM 2: 172.16.40.193 -|
客户端上的一个简短命令行会话显示主机不可用:
C:\Users\>ping 172.16.40.11
Pinging 172.16.40.11 with 32 bytes of data:
Reply from 172.16.40.21: Destination host unreachable
Reply from 172.16.40.21: Destination host unreachable
Reply from 172.16.40.21: Destination host unreachable
Ping statistics for 172.16.40.11:
Packets: Sent = 3, Received = 3, Lost = 0 (0% los
Control-C
^C
C:\Users\>arp -a -v
Interface: 127.0.0.1 --- 0x1
Internet Address Physical Address Type
224.0.0.22 static
239.255.255.250 static
Interface: 0.0.0.0 --- 0xffffffff
Internet Address Physical Address Type
224.0.0.22 01-00-5e-00-00-16 static
Interface: 172.16.40.21 --- 0xc
Internet Address Physical Address Type
172.16.40.1 00-22-56-f7-62-c1 static
172.16.40.2 00-22-90-0d-18-90 dynamic
172.16.40.11 00-00-00-00-00-00 invalid
172.16.40.191 00-0c-29-5e-4f-c1 dynamic
172.16.40.193 00-0c-29-53-fd-25 dynamic
172.16.40.255 ff-ff-ff-ff-ff-ff static
224.0.0.22 01-00-5e-00-00-16 static
224.0.0.252 01-00-5e-00-00-fc static
239.255.255.250 01-00-5e-7f-ff-fa static
255.255.255.255 ff-ff-ff-ff-ff-ff static
Interface: 0.0.0.0 --- 0xffffffff
Internet Address Physical Address Type
224.0.0.22 01-00-5e-00-00-16 static
Interface: 192.168.199.1 --- 0x15
Internet Address Physical Address Type
192.168.199.255 ff-ff-ff-ff-ff-ff static
224.0.0.22 01-00-5e-00-00-16 static
224.0.0.252 01-00-5e-00-00-fc static
239.255.255.250 01-00-5e-7f-ff-fa static
Interface: 192.168.109.1 --- 0x16
Internet Address Physical Address Type
192.168.109.255 ff-ff-ff-ff-ff-ff static
224.0.0.22 01-00-5e-00-00-16 static
224.0.0.252 01-00-5e-00-00-fc static
239.255.255.250 01-00-5e-7f-ff-fa static
我重新启动了主机并再次启动了虚拟机,然后又回到了昨天的情况:
C:\Users\>ping 172.16.40.11
Pinging 172.16.40.11 with 32 bytes of data:
Reply from 172.16.40.11: bytes=32 time<1ms TTL=64
Reply from 172.16.40.11: bytes=32 time<1ms TTL=64
Ping statistics for 172.16.40.11:
Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Control-C
^C
C:\Users\>ping 172.16.40.191
Pinging 172.16.40.191 with 32 bytes of data:
Reply from 172.16.40.191: bytes=32 time<1ms TTL=64
Reply from 172.16.40.191: bytes=32 time<1ms TTL=64
Ping statistics for 172.16.40.191:
Packets: Sent = 2, Received = 2, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Control-C
^C
C:\Users\>ping 172.16.40.193
Pinging 172.16.40.193 with 32 bytes of data:
Reply from 172.16.40.21: Destination host unreachable.
Reply from 172.16.40.21: Destination host unreachable.
Reply from 172.16.40.21: Destination host unreachable.
Ping statistics for 172.16.40.193:
Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
同时在 VM1 上,我能够连接到主机和 VM2 以及网关:
[hadoop@hadoop1 ~]$ ping 172.16.40.1
PING 172.16.40.1 (172.16.40.1) 56(84) bytes of data.
64 bytes from 172.16.40.1: icmp_seq=1 ttl=255 time=0.593 ms
64 bytes from 172.16.40.1: icmp_seq=2 ttl=255 time=0.591 ms
^C
--- 172.16.40.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1307ms
rtt min/avg/max/mdev = 0.591/0.592/0.593/0.001 ms
[hadoop@hadoop1 ~]$ ping 172.16.40.11
PING 172.16.40.11 (172.16.40.11) 56(84) bytes of data.
64 bytes from 172.16.40.11: icmp_seq=1 ttl=64 time=1.02 ms
64 bytes from 172.16.40.11: icmp_seq=2 ttl=64 time=0.109 ms
^C
--- 172.16.40.11 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1103ms
rtt min/avg/max/mdev = 0.109/0.567/1.025/0.458 ms
[hadoop@hadoop1 ~]$ ping 172.16.40.191
PING 172.16.40.191 (172.16.40.191) 56(84) bytes of data.
64 bytes from 172.16.40.191: icmp_seq=1 ttl=64 time=0.033 ms
64 bytes from 172.16.40.191: icmp_seq=2 ttl=64 time=0.018 ms
^C
--- 172.16.40.191 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1194ms
rtt min/avg/max/mdev = 0.018/0.025/0.033/0.009 ms
[hadoop@hadoop1 ~]$ ping 172.16.40.193
PING 172.16.40.193 (172.16.40.193) 56(84) bytes of data.
64 bytes from 172.16.40.193: icmp_seq=1 ttl=64 time=1.98 ms
64 bytes from 172.16.40.193: icmp_seq=2 ttl=64 time=0.134 ms
^C
--- 172.16.40.193 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1587ms
rtt min/avg/max/mdev = 0.134/1.058/1.982/0.924 ms
但在 VM2 上,我只能 ping 通主机和 VM1,而不能 ping 通网关:
[hadoop@hadoop3 ~]$ ping 172.16.40.1
PING 172.16.40.1 (172.16.40.1) 56(84) bytes of data.
^C
--- 172.16.40.1 ping statistics ---
25 packets transmitted, 0 received, 100% packet loss, time 24652ms
[hadoop@hadoop3 ~]$ ping 172.16.40.11
PING 172.16.40.11 (172.16.40.11) 56(84) bytes of data.
64 bytes from 172.16.40.11: icmp_seq=1 ttl=64 time=1.17 ms
64 bytes from 172.16.40.11: icmp_seq=2 ttl=64 time=0.082 ms
^C
--- 172.16.40.11 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1272ms
rtt min/avg/max/mdev = 0.082/0.630/1.178/0.548 ms
[hadoop@hadoop3 ~]$ ping 172.16.40.191
PING 172.16.40.191 (172.16.40.191) 56(84) bytes of data.
64 bytes from 172.16.40.191: icmp_seq=1 ttl=64 time=0.187 ms
64 bytes from 172.16.40.191: icmp_seq=2 ttl=64 time=0.170 ms
^C
--- 172.16.40.191 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1181ms
rtt min/avg/max/mdev = 0.170/0.178/0.187/0.015 ms
[hadoop@hadoop3 ~]$ ping 172.16.40.193
PING 172.16.40.193 (172.16.40.193) 56(84) bytes of data.
64 bytes from 172.16.40.193: icmp_seq=1 ttl=64 time=0.021 ms
64 bytes from 172.16.40.193: icmp_seq=2 ttl=64 time=0.019 ms
^C
--- 172.16.40.193 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1076ms
rtt min/avg/max/mdev = 0.019/0.020/0.021/0.001 ms
最后但同样重要的一点是,主机还可以 ping 虚拟机和网关:
~ # ping 172.16.40.1
PING 172.16.40.1 (172.16.40.1): 56 data bytes
64 bytes from 172.16.40.1: icmp_seq=0 ttl=255 time=0.545 ms
64 bytes from 172.16.40.1: icmp_seq=1 ttl=255 time=3.338 ms
--- 172.16.40.1 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.545/1.942/3.338 ms
~ # ping 172.16.40.11
PING 172.16.40.11 (172.16.40.11): 56 data bytes
64 bytes from 172.16.40.11: icmp_seq=0 ttl=64 time=0.055 ms
--- 172.16.40.11 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.055/0.055/0.055 ms
~ # ping 172.16.40.191
PING 172.16.40.191 (172.16.40.191): 56 data bytes
64 bytes from 172.16.40.191: icmp_seq=0 ttl=64 time=0.131 ms
64 bytes from 172.16.40.191: icmp_seq=1 ttl=64 time=0.124 ms
--- 172.16.40.191 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.124/0.128/0.131 ms
~ # ping 172.16.40.193
PING 172.16.40.193 (172.16.40.193): 56 data bytes
64 bytes from 172.16.40.193: icmp_seq=0 ttl=64 time=0.205 ms
64 bytes from 172.16.40.193: icmp_seq=1 ttl=64 time=0.128 ms
--- 172.16.40.193 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.128/0.166/0.205 ms
vSphere 中的网络配置屏幕截图(hadoop1 和 hadoop3 是两个虚拟机):
这是怎么回事?我该如何进一步诊断发生了什么?
我怀疑由于某种原因,只允许两个 IP 来自网络接口,但这可能是什么原因造成的,我该如何修复它?
答案1
我将检查连接交换机的端口配置以查看是否存在 MAC 地址限制——有些公司会强制每个端口只允许一定数量的 MAC 地址。