我在使用 Debian (Lenny/Linux 2.6.26-2-amd64) 时遇到了一个奇怪的问题,这个问题让我抓狂不已。在我的网络内的一些机器上,我可以顺利地 ping 有问题的主机,其他时候我必须手动对 IP 的 ARP 以太网地址进行硬编码才能建立连接。我终于把它归结为某种涉及 ARP 的问题。我刚刚找到了一种可以让它正常工作的修复方法,但我正在寻找解释这个问题的帮助,而且我不相信我的修复是永久性的。
我的思考过程如下,但我就是无法理解其中的含义:
- 可能是卡的问题吗?(英特尔 82555 修订版 4)
- 是不是因为有两张网卡?(默认路由是eth0)
- 可能是因为网络别名吗?
- 伦尼?
- AMD x86_64?
- 啊……
感谢您提供的任何见解
// Ping doesn't go thru
[gordon@ubuntu ~]$ ping 192.168.135.101
PING 192.168.135.101 (192.168.135.101) 56(84) bytes of data.
--- 192.168.135.101 ping statistics ---
4 packets transmitted, 0 received, 100% packet loss, time 3014ms
// Here's the ARP Table, sometimes the .151 address is good, sometimes it
// also matches the Gateways MAC like .101 is doing right here.
[gordon@ubuntu ~]$ cat /proc/net/arp
IP address HW type Flags HW address Mask Device
192.168.135.15 0x1 0x2 00:0B:DB:2B:24:89 * eth0
192.168.135.151 0x1 0x2 00:0B:6A:3A:30:A6 * eth0
192.168.135.1 0x1 0x2 00:1A:A2:2D:2A:04 * eth0
192.168.135.101 0x1 0x2 00:1A:A2:2D:2A:04 * eth0
// Drop the bad arp table listing and set it manually based on /sbin/ifconfig
[gordon@ubuntu ~]$ sudo arp -d 192.168.135.101
[gordon@ubuntu ~]$ sudo arp -s 192.168.135.101 00:0B:6A:3A:30:A6
// Ping starts going thru..?!?
[gordon@ubuntu ~]$ ping 192.168.135.101
PING 192.168.135.101 (192.168.135.101) 56(84) bytes of data.
64 bytes from 192.168.135.101: icmp_seq=1 ttl=64 time=15.8 ms
64 bytes from 192.168.135.101: icmp_seq=2 ttl=64 time=15.9 ms
64 bytes from 192.168.135.101: icmp_seq=3 ttl=64 time=16.0 ms
64 bytes from 192.168.135.101: icmp_seq=4 ttl=64 time=15.9 ms
--- 192.168.135.101 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3012ms
rtt min/avg/max/mdev = 15.836/15.943/16.064/0.121 ms
以下是我的网络配置。
gordon@db01:~$ /sbin/ifconfig
eth0 Link encap:Ethernet HWaddr 00:0b:6a:3a:30:a6
inet addr:192.168.135.151 Bcast:192.168.135.255 Mask:255.255.255.0
inet6 addr: fe80::20b:6aff:fe3a:30a6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:15476725 errors:0 dropped:0 overruns:0 frame:0
TX packets:10030036 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:18565307359 (17.2 GiB) TX bytes:3412098075 (3.1 GiB)
eth0:0 Link encap:Ethernet HWaddr 00:0b:6a:3a:30:a6
inet addr:192.168.135.150 Bcast:192.168.135.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth0:1 Link encap:Ethernet HWaddr 00:0b:6a:3a:30:a6
inet addr:192.168.135.101 Bcast:192.168.135.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
eth1 Link encap:Ethernet HWaddr 00:e0:81:2a:6e:d0
inet addr:10.10.62.1 Bcast:10.10.62.255 Mask:255.255.255.0
inet6 addr: fe80::2e0:81ff:fe2a:6ed0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:10233315 errors:0 dropped:0 overruns:0 frame:0
TX packets:19400286 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1112500658 (1.0 GiB) TX bytes:27952809020 (26.0 GiB)
Interrupt:24
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:16436 Metric:1
RX packets:387 errors:0 dropped:0 overruns:0 frame:0
TX packets:387 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:41314 (40.3 KiB) TX bytes:41314 (40.3 KiB)
gordon@db01:~$ sudo mii-tool -v eth0
eth0: negotiated 100baseTx-FD, link ok
product info: Intel 82555 rev 4
basic mode: autonegotiation enabled
basic status: autonegotiation complete, link ok
capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
advertising: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD flow-control
link partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
gordon@db01:~$ sudo route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
localnet * 255.255.255.0 U 0 0 0 eth0
10.10.62.0 * 255.255.255.0 U 0 0 0 eth1
default 192.168.135.1 0.0.0.0 UG 0 0 0 eth0
答案1
无论出于什么原因,您的网关都绑定了 192.168.135.101。
我敢打赌,如果你关闭 eth0:1 并且 ARP 表中没有 192.168.135.101 的条目,它仍然会响应 ICMP 请求。
重点关注地址为 00:1A:A2:2D:2A:04 的机器,它就是罪魁祸首。
答案2
我会清空 arp 缓存并在尝试 ping 时运行 wireshark。您将看到 ARP 请求和响应。这可能会让您很好地了解为什么您的机器无法正常工作。
您有可以向我们展示的网络示意图吗?
答案3
数周以来,我的某些 IP 地址无法在 BeThere 宽带之外 ping 通,我认为这是因为 ISP 路由器保存了错误的 ARP 表。
这可能是由于 ARP 中毒攻击造成的,但要对远程 ARP 表进行排序,请尝试以下 Linux 命令:
arping -I <接口> <IP 地址>