ARP协议讲解

ARP协议

介绍

ARP(Address Resolution Protocol),为了在以太网硬件上传输数据将网络协议地址(IP地址)转化为48bit的以太网地址(mac地址)

[The purpose of this RFC is to present a method of Converting
Protocol Addresses (e.g., IP addresses) to Local Network
Addresses (e.g., Ethernet addresses). This is a issue of general
concern in the ARPA Internet community at this time. The
method proposed here is presented for your consideration and
comment. This is not the specification of a Internet Standard.]

Mac地址 由设备制造商定义/分配,每一个硬件设备都有一个链路层主地址(MAC地址),保存在设备的永久内存中。设备的mac地址不会改变(现在可以进行mac地址伪装)
IP地址 由用户配置给网络接口, 网络接口的IP地址是可以发生变化的(通过DHCP获取IP,变化速度比较快)

原理

获取目的端的MAC地址

  1. 发送ARP请求的以太网数据包给以太网上的每个主机,即广播(以太网地址填全1)。ARP请求包中包含了目的主机的IP地址。
  2. 目的主机收到了该ARP请求之后,会发送一个ARP应答,里面包含了目的主机的MAC地址。

格式

大小 名称
16.bit 硬件类型
16.bit 协议类型
8.bit 硬件地址长度
8.bit 协议地址长度
16.bit 操作码
n.bit 发送端硬件地址
m.bit 发送端协议地址
n.bit 接收端硬件地址
m.bit 接收端协议地址

n一般是48,m一般是32

参考文献:
https://www.rfc-editor.org/rfc-index-100a.html
https://www.cnblogs.com/csguo/p/7542944.html
https://www.cnblogs.com/chenshengkai/p/13936532.html
https://www.cnblogs.com/snakewind/archive/2011/06/27/2091757.html
https://zhuanlan.zhihu.com/p/478259733
https://zhuanlan.zhihu.com/p/100151937
https://zhuanlan.zhihu.com/p/427573801
https://blog.csdn.net/u014302425/article/details/113822870

posted @   xifan77  阅读(26)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统
点击右上角即可分享
微信分享提示