ping - 同一家庭网络中的 Ubuntu 和 Mac 找不到彼此
问题描述
这是设置:
我有 4 台设备连接到我的家庭 Wifi,我可以确认它们的 IP 地址:
ipad : 192.168.1.19
phone : 192.168.1.5
PC with Ubuntu 18.04 : 192.168.1.14
Macbook Pro : 192.168.1.3
所有 4 台设备均通过 wifi 连接。没有以太网电缆连接
在我的 PC (Ubuntu 18.04) 上,我可以arp -a
用来发现 ipad 和手机:
john@home:~$ arp -a
? (192.168.1.19) at 92:c4:78:3c:46:16 [ether] on wlo1
_gateway (192.168.1.1) at e4:7e:66:1f:bf:4c [ether] on wlo1
? (192.168.1.5) at 26:36:46:f9:69:83 [ether] on wlo1
但是无法扫描 Macbook Pro。
在 Macbook Pro 上,arp -a
给出以下结果:
john@macbook:~$ arp -a
? (192.168.1.1) at e4:7e:66:1f:bf:4c on en0 ifscope [ethernet]
? (192.168.1.3) at 98:5a:eb:8d:ef:e2 on en0 ifscope permanent [ethernet]
? (192.168.1.5) at 26:36:46:f9:69:83 on en0 ifscope [ethernet]
? (192.168.1.14) at 4:33:c2:c4:2:a2 on en0 ifscope [ethernet]
? (192.168.1.19) at 92:c4:78:3c:46:16 on en0 ifscope [ethernet]
? (224.0.0.251) at 1:0:5e:0:0:fb on en0 ifscope permanent [ethernet]
? (224.0.0.252) at 1:0:5e:0:0:fc on en0 ifscope permanent [ethernet]
? (239.255.255.250) at 1:0:5e:7f:ff:fa on en0 ifscope permanent [ethernet]
如您所见,可以找到ipad、手机和PC。问题是对 ipad 和手机的 ping 正常,但对 PC 的 ping 失败:
john@macbook:~$ ping 192.168.1.19
PING 192.168.1.19 (192.168.1.19): 56 data bytes
64 bytes from 192.168.1.19: icmp_seq=0 ttl=64 time=42.713 ms
64 bytes from 192.168.1.19: icmp_seq=1 ttl=64 time=43.392 ms
64 bytes from 192.168.1.19: icmp_seq=2 ttl=64 time=2.472 ms
64 bytes from 192.168.1.19: icmp_seq=3 ttl=64 time=40.964 ms
john@macbook:~$ ping 192.168.1.5
PING 192.168.1.5 (192.168.1.5): 56 data bytes
64 bytes from 192.168.1.5: icmp_seq=0 ttl=64 time=185.370 ms
64 bytes from 192.168.1.5: icmp_seq=1 ttl=64 time=7.653 ms
64 bytes from 192.168.1.5: icmp_seq=2 ttl=64 time=853.861 ms
64 bytes from 192.168.1.5: icmp_seq=3 ttl=64 time=6.430 ms
64 bytes from 192.168.1.5: icmp_seq=4 ttl=64 time=147.860 ms
64 bytes from 192.168.1.5: icmp_seq=5 ttl=64 time=248.788 ms
john@macbook:~$ ping 192.168.1.14
PING 192.168.1.14 (192.168.1.14): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
我已经确认防火墙 ID 在装有 Ubuntu 18.04 的 PC 上处于非活动状态:
john@home:~$ sudo ufw status
[sudo] password for john:
Status: inactive
这里出了什么问题?为什么 Macbook Pro 对 PC 是不可见的,但 PC 对 MacBook 是可见的?为什么 ping 失败?
以下是我第二天观察到的:
现在我arp -a
在 PC 中执行命令,神秘地我可以在输出中看到 Macbook 设备和电话:
_gateway (192.168.1.1) at e4:7e:66:1f:bf:4c [ether] on wlo1
? (192.168.1.5) at 26:36:46:f9:69:83 [ether] on wlo1
? (192.168.1.3) at <incomplete> on wlo1
我不知道如何,但它突然出现在 arp 表中。但是, ping 会给出这个:
john@home:~$ ping 192.168.1.3
PING 192.168.1.3 (192.168.1.14) 56(84) bytes of data.
From 192.168.1.14 icmp_seq=1 Destination Host Unreachable
From 192.168.1.14 icmp_seq=2 Destination Host Unreachable
From 192.168.1.14 icmp_seq=3 Destination Host Unreachable
From 192.168.1.14 icmp_seq=4 Destination Host Unreachable
From 192.168.1.14 icmp_seq=5 Destination Host Unreachable
From 192.168.1.14 icmp_seq=6 Destination Host Unreachable
From 192.168.1.14 icmp_seq=7 Destination Host Unreachable
From 192.168.1.14 icmp_seq=8 Destination Host Unreachable
From 192.168.1.14 icmp_seq=9 Destination Host Unreachable
^C
--- 192.168.1.3 ping statistics ---
10 packets transmitted, 0 received, +9 errors, 100% packet loss, time 9195ms
pipe 4
john@home:~$ ^C
为什么在PC端不一致?有时您可以从 PC 中发现 Macbook,有时则不能。
而且您无法在 PC 和 Macbook 之间进行 ping 操作。但是您可以从 Macbook ping 电话/ipad 吗?
解决方案
推荐阅读
- apostrophe-cms - 事件页面上的错误:未知的块标签项
- javascript - 垂直 CSS / jQuery 下拉菜单问题?
- qt - 如何在 Qt 中创建一个透明的非模态对话框,该对话框包含在主应用程序窗口中并且可以包含 QPushButtons
- php - 双重请求导致双重插入
- python - 在python中将字符串与多个匹配项分开
- sql - oracle中跨表的case when语句
- react-native - 如何为 Android 本地化 react-native-image-crop-picker 的裁剪屏幕?
- sql-server - SQL 维护计划 - 确定步骤的持续时间
- recaptcha - 我可以在隐藏徽章时翻译使用条款 recaptcha 吗?
- python - __str__ 返回非字符串(产品类型)