当我们可以从以太网标头中提取回复/请求 ARP 数据包中的 MAC 地址时,它有什么用

发布于 2025-01-05 02:54:12 字数 122 浏览 4 评论 0原文

我很困惑为什么我们需要 ARP 数据包中的 MAC 地址,而我们可以从以太网标头中提取它。只需保留 IP 地址和其他字段不变,并删除 MAC 地址即可。我们可以从以太网中提取它们。我的想法中遗漏了一些东西。

谢谢。

I am getting confused why do we require mac addresses in ARP packet, when we can extract it from ethernet header. Just keep the IP addresses and other fields as they are and remove the MAC address. We can extract them from ethernet. AM I missing something in my thinking.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

白衬杉格子梦 2025-01-12 02:54:12

当我们可以提取它时,为什么我们需要在 ARP 数据包中包含 MAC 地址
来自以太网标头

ARP 数据包正文中没有 MAC 地址将导致(至少)以下情况:

  1. ARP 无法通过 L2 网桥:网桥需要转发传入的 ARP 请求,并将自己的出接口的 MAC 放入 L2 协议头的源字段中。回复(除非广播)将被发送至网桥本身而不被转发。 (参见此处查看表格,显示和比较 ARP 消息的 L2 和 L3 字段。)

  2. 任何 ARP 实现都依赖于底层 MAC 协议:接收 ARP 消息的代码需要有关在哪里查找源 MAC 地址的信息MAC 层,并且此信息必须可由 ARP 代码访问。

why do we require mac addresses in ARP packet, when we can extract it
from ethernet header

Not having MAC addresses in the ARP packet body would result in (at least) the following:

  1. ARP would not work over L2 bridge: the bridge needs to forward incoming ARP request putting MAC of own outgoing interface in the source field of the L2 protocol header. Replies (unless broadcasted) would be destined to the bridge itself and not forwarded. (See here for the table, showing and comparing L2 and L3 fields of ARP messages.)

  2. Any ARP implementation would be dependent on the underlying MAC protocol: the code receiving ARP messages would need information about where to look for the source MAC address in the MAC layer, and this information must be accessible by the ARP code.

别挽留 2025-01-12 02:54:12

ARP 请求以广播目标 MAC 地址和发送者的 MAC 地址作为源 MAC 地址发出。这是因为发送者不知道目标 MAC 地址并且正在询问它。广播目标 MAC 地址可确保 LAN 上的每个主机都会收到请求。

ARP 回复以原始发送者的地址作为目的地址,这样回复只会到达原始发送者,而不会打扰 LAN 上的所有主机。

An ARP request goes out with the broadcast destination MAC address and the sender's MAC address as the source MAC address. This is because the sender doesn't know the destination MAC address and is asking for it. The broadcast destination MAC address makes sure that every host on the LAN will receive the request.

The ARP reply has the original sender's address as the destination address so that the reply only goes to the original sender, and it doesn't bother all the hosts on the LAN.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文