ARP 是一个独立的进程,就像 IP 是一个独立的进程一样。帧将具有以太网类型字段,该字段告诉数据链路(以太网、Wi-Fi 等)协议应将帧有效负载发送到哪个进程。
只有设置了以太网类型的帧才能0x0806将帧有效负载发送到 ARP,这可能会更新 ARP 表。如果 Ether Type 为0x0800,则将帧有效负载发送到 IPv4 进程。如果 Ether Type 为0x86DD,则将帧负载发送到 IPv6 进程。等等。
未将以太网类型字段设置为0x0806不更新 ARP 表的接收帧。这是设计使然,您可以在RFC 826, An Ethernet Address Resolution Protocol中阅读它,其中描述了 ARP 的工作原理。事实上,并非所有发送到 ARP 的内容都会更新 ARP 表。ARP 回复当然可以,但是如果该 IPv4 地址的条目已经存在,ARP 收到的其他内容只会更新 ARP 表:
?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.
编辑:
你的问题现在完全不同了,那是不好的形式。请在新问题中提出不同的问题。
您需要遵循数据包。如果Hb发送到不同的网络,那么它将包含数据包的帧发送到其配置的网关(路由器),网关将数据包路由到不同的网络,因此包含数据包的新帧到达具有 MAC 地址的不同接口因为路由器将剥离包含已更改的原始源 MAC 地址的原始帧。
Ha在其接口上从路由器接收帧10.2.0.5,然后将其发送到网络堆栈。Ha然后处理数据报,并将响应发送回Hb其10.1.0.5接口,因为其内部路由表将该网络作为直接连接的网络。
听起来您认为因为在一个接口上收到了一个数据包,它应该在同一个接口上回复,但这不是它的工作原理。每个数据包都是单独路由的,无论之前可能有任何数据包。您的场景永远不会从接口发送Ha数据Hb包10.2.0.5。
编辑2:
如果您在正确的 ( 10.1.0.5) 界面上没有看到回复,那么您的主机有问题,它的行为在这里是题外话。我已经描述了主机应该做什么,但如果你的主机做了不同的事情,那么你有一些配置错误,测量问题,或者你的主机的行为是非标准的。这些问题都不是在这里要问的,因为你声称是一个实验室,所以对于Server Fault来说这将是题外话,但你可以尝试在Super User、Unix & Linux或Ask Ubuntu上询问它。