我在本地网络上有两台 ubuntu 计算机,但它们都不能互相 ping 通。每次尝试时,我都会收到“目标主机无法访问”错误消息。两台计算机都可以在出现任何问题的情况下访问互联网。
我有一个来自 Telus 的 ActionTech v1000h 路由器。我已经与他们的一位客户代表联系过,他们说应该没有任何理由说明两台设备无法在网络上相互 ping 通。
我完全不知所措,你们有什么想法吗?
电脑1:
ifconfig -a
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:10084 errors:0 dropped:0 overruns:0 frame:0
TX packets:10084 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:797420 (797.4 KB) TX bytes:797420 (797.4 KB)
wlan0 Link encap:Ethernet HWaddr c4:85:08:77:d3:f5
inet addr:192.168.1.77 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::c685:8ff:fe77:d3f5/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:373068 errors:0 dropped:0 overruns:0 frame:0
TX packets:380158 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:103445020 (103.4 MB) TX bytes:112630337 (112.6 MB)
Run Code Online (Sandbox Code Playgroud)
路由 -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.254 0.0.0.0 UG 0 0 0 wlan0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 9 0 0 wlan0
Run Code Online (Sandbox Code Playgroud)
须藤 iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Run Code Online (Sandbox Code Playgroud)
电脑2:
ifconfig -a
etho0 Link encap:Ethernet HWaddr 00:24:8c:ae:f6:91
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:2
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:110 errors:0 dropped:0 overruns:0 frame:0
TX packets:110 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:8414 (8.4 KB) TX bytes:8414 (8.4 KB)
wlan0 Link encap:Ethernet HWaddr 00:22:43:9b:7b:64
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::222:43ff:fe9b:7b64/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:252 errors:0 dropped:0 overruns:0 frame:0
TX packets:435 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:123143 (123.1 KB) TX bytes:65828 (65.8 KB)
Run Code Online (Sandbox Code Playgroud)
路由 -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.254 0.0.0.0 UG 0 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 9 0 0 wlan0
Run Code Online (Sandbox Code Playgroud)
须藤 iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Run Code Online (Sandbox Code Playgroud)
编辑:计算机 1 尝试 ping 计算机 2 时的错误示例:
平 192.168.1.2
PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
From 192.168.1.77 icmp_seq=1 Destination Host Unreachable
From 192.168.1.77 icmp_seq=2 Destination Host Unreachable
From 192.168.1.77 icmp_seq=3 Destination Host Unreachable
From 192.168.1.77 icmp_seq=4 Destination Host Unreachable
From 192.168.1.77 icmp_seq=5 Destination Host Unreachable
From 192.168.1.77 icmp_seq=6 Destination Host Unreachable
^C
--- 192.168.1.2 ping statistics ---
7 packets transmitted, 0 received, +6 errors, 100% packet loss, time 6031ms
pipe 3
Run Code Online (Sandbox Code Playgroud)
编辑 2: arp -a两台计算机的
电脑1:
? (192.168.1.254) at 20:76:00:f5:3b:70 [ether] on wlan0
Run Code Online (Sandbox Code Playgroud)
电脑2:
? (192.168.1.254) at 20:76:00:f5:3b:70 [ether] on wlan0
? (192.168.1.77) at <incomplete> on wlan0
Run Code Online (Sandbox Code Playgroud)
编辑 3: nmap -sn 192.168.1.0/24在计算机 2 上
Starting Nmap 6.40 ( http://nmap.org ) at 2014-05-07 21:14 PDT
Nmap scan report for 192.168.1.2
Host is up (0.00024s latency).
Nmap done: 256 IP addresses (1 host up) scanned in 3.30 seconds
Run Code Online (Sandbox Code Playgroud)
编辑 4:两台计算机的 tcpdump 日志,而第一次 ping 192.168.1.254 然后互相:
电脑1:
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on wlan0, link-type EN10MB (Ethernet), capture size 65535 bytes
22:45:01.661300 ARP, Request who-has 192.168.1.2 tell 192.168.1.77, length 28
22:45:02.659393 ARP, Request who-has 192.168.1.2 tell 192.168.1.77, length 28
22:45:03.659394 ARP, Request who-has 192.168.1.2 tell 192.168.1.77, length 28
22:45:04.676872 ARP, Request who-has 192.168.1.2 tell 192.168.1.77, length 28
22:45:05.675391 ARP, Request who-has 192.168.1.2 tell 192.168.1.77, length 28
22:45:06.675396 ARP, Request who-has 192.168.1.2 tell 192.168.1.77, length 28
22:45:07.692825 ARP, Request who-has 192.168.1.2 tell 192.168.1.77, length 28
22:45:48.379058 ARP, Request who-has 192.168.1.77 tell 192.168.1.254, length 28
22:45:48.379108 ARP, Reply 192.168.1.77 is-at c4:85:08:77:d3:f5, length 28
22:45:54.419388 ARP, Request who-has 192.168.1.254 tell 192.168.1.77, length 28
22:45:54.420875 ARP, Reply 192.168.1.254 is-at 20:76:00:f5:3b:70, length 28
Run Code Online (Sandbox Code Playgroud)
电脑2:
reading from file pc2.pcap, link-type EN10MB (Ethernet)
22:44:43.538367 ARP, Request who-has 192.168.1.254 tell 192.168.1.2, length 28
22:44:43.676705 ARP, Reply 192.168.1.254 is-at 20:76:00:f5:3b:70 (oui Unknown), length 28
22:45:02.107935 ARP, Request who-has 192.168.1.254 tell 192.168.1.2, length 28
22:45:02.107951 ARP, Reply 192.168.1.254 is-at 20:76:00:f5:3b:70 (oui Unknown), length 28
22:45:06.780619 ARP, Request who-has 192.168.1.77 tell 192.168.1.2, length 28
22:45:07.778419 ARP, Request who-has 192.168.1.77 tell 192.168.1.2, length 28
22:45:08.778419 ARP, Request who-has 192.168.1.77 tell 192.168.1.2, length 28
22:45:09.796214 ARP, Request who-has 192.168.1.77 tell 192.168.1.2, length 28
Run Code Online (Sandbox Code Playgroud)
编辑 5:为两台计算机 etho0 设置静态 ips 并使用互联网电缆连接它们。两台电脑绝对可以通过网线互相ping通!ifconfig -aeth0 结果:
电脑1:
eth0 Link encap:Ethernet HWaddr 68:68:68:00:62:a4
inet addr:192.168.1.10 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::6a68:68ff:fe00:62a4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:15 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4060 (4.0 KB) TX bytes:7629 (7.6 KB)
Run Code Online (Sandbox Code Playgroud)
电脑2:
eth0 Link encap:Ethernet HWaddr 00:24:8c:ae:f6:91
inet addr:192.168.1.20 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::224:8cff:feae:f691/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:250 errors:0 dropped:0 overruns:0 frame:0
TX packets:130 errors:0 dropped:0 overruns:0 carrier:3
collisions:0 txqueuelen:1000
RX bytes:26501 (26.5 KB) TX bytes:20897 (20.8 KB)
Run Code Online (Sandbox Code Playgroud)
从两台计算机ping 网关ping 192.168.1.254
然后尝试ping comp1 到compt2 和comp2 到comp1 然后arp -a从两个盒子中发布结果
编辑
有趣的是,有东西阻塞了交通
sudo tcpdump -ni wlan0 arp在两台计算机上的一个窗口中运行,然后尝试在两台计算机上再次从另一个窗口互相ping通和网关并发布结果
编辑2
到目前为止,这表明 comp1 正在执行发送 arp 请求(要求 comp2s 以太网地址)但没有收到 arp 回复(听到任何回复)的假设。需要查看 PC2 的 tcpdump 才能看到全貌。无论是运行在屏幕命令或做这在PC1sudo tcpdump -w pc1.pcap -ni wlan0 arp &和PC2上sudo tcpdump -w pc2.pcap -ni wlan0 arp & :应把它的背景和给你的提示坪回来。ping 失败后,将作业带回前台并fg %1停止ctrl+c并读取写入的文件sudo tcpdump -r pc1/2.pcap
Edit3
PC 正在做他们应该做的事情,将 ARP 输出,但它们没有通过指向路由器的点。也许禁用防火墙设置,怀疑它是否支持 VLAN?有点希望你让它在22:45:48.379058运行更长时间你的路由器在寻找 PC1 时发送了它自己的 ARP 请求,22:45:48.379058 ARP, Request who-has 192.168.1.77 tell 192.168.1.254, length 28两台 PC 都应该看到它,我们可以看到 PC1 看到它并用它的 IP 回复但不能告诉 PC2 是否得到它,因为你在22:45:09.796214停止了它。假设您的时钟与 NTP 同步。
编辑4
看看还是没有解决。没有看到您在两台 PC 上都有 eth 适配器。您能否通过 eth 而不是 wlan 硬连线到路由器,然后看看您是否可以 ping 通?还是换个路由器?或者在手机上做一个热点连接两台电脑并尝试ping?另外,惊讶地发现您能够将两台 PC 连接在一起并互相 ping 通,您是否使用了交叉电缆?
当我看到像这样奇怪的东西时,我的第一反应是安装wireshark。
然后进行设置,以便您有权以非 root 身份使用它:
sudo dpkg-reconfigure wireshark-common
Run Code Online (Sandbox Code Playgroud)
选择“是”选项。
usermod -a -G wireshark your-user-name
Run Code Online (Sandbox Code Playgroud)
注销并重新登录以获取新的组成员身份,您现在可以作为非 root 用户运行捕获数据包。
然后在机器上运行wireshark,选择连接到网络的接口。尽量减少测试以外的流量,以便更轻松地解释结果。
如果您在一台机器上运行wireshark,然后尝试从另一台机器上执行ping操作,您应该会在运行wireshark的机器上看到类似“谁拥有<您正在尝试ping的ip>”的内容。如果您收到此消息,则表明尝试 ping 的计算机已收到 Wireshark 计算机的请求。希望您还应该在wireshark 中看到类似“<您尝试ping 的ip 地址>位于<mac 地址>”的内容。如果这样做,则 Wireshark 计算机正在响应。如果是这种情况,请尝试在 ping 计算机上运行 Wireshark,看看是否可以在 ping 计算机上看到“<您尝试 ping 的 IP 地址>位于 <mac 地址>”响应。
如果这水平太低并且超出了您的理解范围,我深表歉意。这种方法确实深入细节。但能够看到网络上实际发生的情况往往会使问题变得更加明显。
| 归档时间: |
|
| 查看次数: |
164763 次 |
| 最近记录: |