Linux

無法 ping 主機陳舊的 ARP 記憶體?

  • March 21, 2010

我在 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

無論出於何種原因,您的網關都綁定了 192.168.135.101。

我敢打賭,如果你關閉了 eth0:1 並且 ARP 表沒有 192.168.135.101 的條目,它仍然會響應 ICMP 請求。

關注地址為 00:1A:A2:2D:2A:04 的機器,這是罪魁禍首。

當我嘗試 ping 時,我會清空 arp 記憶體並執行 wireshark。您將看到 ARP 請求和響應。這可能會讓您很好地了解為什麼您的機器的 ping 不能正常工作。

您有可以向我們展示的網路示意圖嗎?

引用自:https://serverfault.com/questions/121782