![無法透過本機網路從 Android 裝置 ping\trace win10 電腦](https://rvso.com/image/1505669/%E7%84%A1%E6%B3%95%E9%80%8F%E9%81%8E%E6%9C%AC%E6%A9%9F%E7%B6%B2%E8%B7%AF%E5%BE%9E%20Android%20%E8%A3%9D%E7%BD%AE%20ping%5Ctrace%20win10%20%E9%9B%BB%E8%85%A6.png)
本地5G wifi網路192.168.2.0/24
Android 5.1.1\CyanogenMod 12.1 裝置 ip: 192.168.2.222 (ubeogesh-opo) (我使用 jackpal.androidterm 在其上執行命令)
Windows 10 電腦 IP:192.168.2.150(ubeogesh-pc)
停用 Windows 防火牆,啟用網路探索(對於所有設定檔)
路由器IP:192.168.2.1
從 PC 到 Android 的 Ping 操作:
Pinging 192.168.2.222 with 32 bytes of data:
Reply from 192.168.2.222: bytes=32 time=73ms TTL=63
從 PC 到 Android 的 Traceroute:
Tracing route to ubeogesh-opo [192.168.2.222]
over a maximum of 30 hops:
1 1 ms <1 ms <1 ms router.asus.com [192.168.2.1]
2 308 ms 1 ms 1 ms ubeogesh-opo [192.168.2.222]
Trace complete.
從 Android 裝置 Ping 到 PC:
PING 192.168.2.150 (192.168.2.150) 56(84) bytes of data.
^C
--- 192.168.2.150 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2002ms
從 Android 到路由器的 Ping 和追蹤路徑:
22|u0_a72@A0001:/ $ ping 192.168.2.1
PING 192.168.2.1 (192.168.2.1) 56(84) bytes of data.
64 bytes from 192.168.2.1: icmp_seq=1 ttl=64 time=109 ms
64 bytes from 192.168.2.1: icmp_seq=2 ttl=64 time=127 ms
64 bytes from 192.168.2.1: icmp_seq=3 ttl=64 time=115 ms
^C
--- 192.168.2.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 109.158/117.387/127.349/7.526 ms
u0_a72@A0001:/ $ tracepath 192.168.2.1
1: ubeogesh-opo 0.323ms pmtu 1500
1: router.asus.com 1.907ms reached
1: router.asus.com 39.411ms reached
Resume: pmtu 1500 hops 1 back 64
從 Android 到 PC 的追蹤路徑:
tracepath 192.168.2.150
1: ubeogesh-opo 0.565ms pmtu 1500
1: no reply
^C
從路由器 CP,我可以 ping PC 和 Android:
traceroute to 192.168.2.150 (192.168.2.150), 30 hops max, 38 byte packets
1 192.168.2.150 (192.168.2.150) 1.072 ms * 1.391 ms
traceroute to 192.168.2.222 (192.168.2.222), 30 hops max, 38 byte packets
1 192.168.2.222 (192.168.2.222) 109.768 ms 1.159 ms 1.015 ms
PING 192.168.2.150 (192.168.2.150): 56 data bytes
64 bytes from 192.168.2.150: seq=0 ttl=128 time=2.087 ms
--- 192.168.2.150 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 2.087/2.087/2.087 ms
PING 192.168.2.222 (192.168.2.222): 56 data bytes
64 bytes from 192.168.2.222: seq=0 ttl=64 time=259.913 ms
--- 192.168.2.222 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 259.913/259.913/259.913 ms
最讓我困擾的是,從 PC 到 Android 的追蹤路由將路由器包含在追蹤中,即忽略同一網路中的兩個設備,無論如何都會先跳到路由器。我嘗試過檢查 Android 裝置上的路線,但我無法從中讀取太多內容:
130|u0_a72@A0001:/ $ ip route show
192.168.2.0/24 dev wlan0 proto kernel scope link src 192.168.2.222
我還嘗試透過路由器明確添加到電腦的路由,但失敗了:
ip route add 192.168.2.150/32 via 192.168.2.1
Cannot talk to rtnetlink: Permission denied
我還可以檢查什麼?問題可能出在哪裡?
答案1
我認為問題在於 SELinux 阻止您(shell 使用者)建立套接字 rtnetlink。所以我建議先嘗試將selinux設定為寬容模式。這不是一個簡單的操作,因為您應該root您的手機並安裝類似的應用程式SELinux模式改變去做吧。
答案2
這是我的 Windows 10 電腦的問題。其他設備也無法連接到它。透過重置所有網路設定解決了該問題。這不是一個非常精確\優雅的解決方案(我希望我知道是什麼原因造成的),但它有效。
這就是我所做的:
- 進入win 10設定
- 轉到狀態
- 從那裡使用“網路重置”功能。
重啟後問題不再出現