ping后第三方arp表为空

网络工程 arp
2021-07-07 12:15:05

我有一个小型 LAN,其中三个主机 A、B、C 通过交换机连接。如果 A ping B,则 A 和 B 的 arp 表会按预期填充。但是 C 的 arp 表仍然是空的,即使它收到了 arp 广播。这是预期的行为吗?

我认为 arp 广播总是会导致每个主机更新他们的 arp。

假设主机 C 想要 ping 主机 A。因为 C 不知道 A 的 mac 地址,所以它必须发送一个 arp 广播。这似乎有点不必要。如果它第一次知道A的mac-address,它就不需要广播。

谁能解释一下?(如果您能指出验证这一点的官方文件,我会更高兴)

谢谢 :-)

1个回答

如果它遵循RFC 826中规定的过程,那么这是预期的行为。主机 C 应仅更新现有条目(如果存在)。如果它是 ARP 请求的目标,它应该只添加一个条目。

RFC 826,这里是处理流程:

Packet Reception:
-----------------

When an address resolution packet is received, the receiving
Ethernet module gives the packet to the Address Resolution module
*which goes through an algorithm similar to the following.
Negative conditionals indicate an end of processing and a
discarding of the packet.

?Do I have the hardware type in ar$hrd?
Yes: (almost definitely)
  [optionally check the hardware length ar$hln]
  ?Do I speak the protocol in ar$pro?
  Yes:
    [optionally check the protocol length ar$pln]
    Merge_flag := false
    If the pair <protocol type, sender protocol address> is
        already in my translation table, update the sender
        hardware address field of the entry with the new
        information in the packet and set Merge_flag to true.
    ?Am I the target protocol address?
    Yes:
      If Merge_flag is false, add the triplet <protocol type,
          sender protocol address, sender hardware address> to
          the translation table.
      ?Is the opcode ares_op$REQUEST?  (NOW look at the opcode!!)
      Yes:
        Swap hardware and protocol fields, putting the local
            hardware and protocol addresses in the sender fields.
        Set the ar$op field to ares_op$REPLY
        Send the packet to the (new) target hardware address on
            the same hardware on which the request was received.