ARP/RARP报文
ARP(Address Resolution Protocol,地址解析协议)是用来将IP地址解析为MAC地址的协议。
RARP(Reverse Address Resolution Protocol,反向地址解析协议)是用来将MAC地址解析为IP地址的协议。
协议栈结构
ARP/RARP协议栈结构
+-------------------------------------+
| ARP/RARP |
+-------------------------------------+
| L2 Type = 0x0806/0x8035 |
+-------------------------------------+
| L1 |
+-------------------------------------+
报文格式
ARP&RARP报文格式
+0--------------7--------------15----------------23----------------31
| Ethernet Address of Destination[0-47] |
+ +--------------------------------+
| | |
+----------------------------------+ |
| Ethernet Address of Sender[0-47] |
+----------------------------------+--------------------------------+
| Frame Type | Hardware Type |
+----------------------------------+----------------+---------------+
| Protocol Type | Hardware Length|Protocol Length|
+----------------------------------+----------------+---------------+
| OP | |
+----------------------------------+ |
| Ethernet Address of Sender[0-47] |
+-------------------------------------------------------------------+
| IP Address of Sender |
+-------------------------------------------------------------------+
| Ethernet Address of Destination[0-47] |
+ +--------------------------------+
| | IP Address of Destination[0-15]|
+----------------------------------+--------------------------------+
| IP Address of Destination[16-31] |
+----------------------------------+
ARP&RARP报文字段格式
| 字段 |
Length |
含义 |
| Ethernet Address of Destination |
48bits |
目的MAC地址。发送ARP请求时,为广播的MAC地址,0xFFFF-FFFF-FFFF。 |
| Ethernet Address of Sender |
48bits |
源MAC地址。 |
| Frame Type |
16bits |
表示后面数据的类型。对于ARP请求或应答来说,该字段的值为0x0806。 |
| Hardware Type |
16bits |
表示硬件地址的类型。对于以太网,该类型的值为“1”。 |
| Protocol Type |
16bits |
表示发送方要映射的协议地址类型。对于IP地址,该值为0x0800。 |
| Hardware Length |
8bits |
表示硬件地址的长度,单位是字节。对于ARP请求或应答来说,该值为6。 |
| Protocol Length |
8bits |
表示协议地址的长度,单位是字节。对于ARP请求或应答来说,该值为4。 |
| OP |
16bits |
操作类型:1 ARP请求2 ARP应答3 RARP请求4 RARP应答 |
| Ethernet Address of Sender |
48bits |
发送方以太网地址。这个字段和ARP报文首部的源以太网地址字段是重复信息。 |
| IP Address of Sender |
32bits |
发送方的IP地址。 |
| Ethernet Address of Destination |
48bits |
接收方的以太网地址。发送ARP请求时,该处填充值为0x00.00.00.00.00.00。 |
| IP Address of Destination |
32bits |
接收方的IP地址。 |
参考标准
| 标准 |
描述 |
| RFC 826 |
Ethernet Address Resolution Protocol |
| RFC 903 |
Reverse Address Resolution Protocol |
| RFC 1027 |
Using ARP to Implement Transparent Subnet Gateways |
| RFC 1042 |
Standard for the Transmission of IP Datagrams over IEEE 802 Networks |
| RFC 5227 |
IPv4 Address Conflict Detection |
No comments to display
No comments to display