图21.3ARP分组的封装 ARP request or reply packet Type:0x0806 Preamble Destination Source and SFD address address Type Data CRC 8 bytes 6 bytes 6 bytes 2 bytes 4 bytes 21.6
21.6 图 21.3 ARP 分组的封装
图21.4使用ARP的四种情况 Target IP address: Target IP address: Destination address in the IP datagram IP address of a router Sender Sender Host Host Host Router LAN LAN × Receiver Receiver Case 1.A host has a packet to send to Case 2.A host wants to send a packet to another host on the same network. another host on another network. It must first be delivered to a router. Target IP address: Target IP address: IP address of the appropriate router found in the routing table Destination address in the IP datagram Sender Sender Host Router Router Router LAN LAN Receiver Receiver Case 3.A router receives a packet to be sent Case 4.A router receives a packet to be sent to a host on another network.It must first to a host on the same network. be delivered to the appropriate router. 21.7
21.7 图 21.4 使用ARP的四种情况
注意 ARP请求报文是广播发送, ARP回答报文是单播发送. 21.8
21.8 ARP 请求报文是广播发送; ARP 回答报文是单播发送. 注意
例21.1 一个主机的IP地址为130.23.43.20,物理地址为 B2:34:55:10:22:10,它有一个分组想要发送给另一个主 机,其P地址为130.23.43.25,物理地址为 A4:6E:F4:59:83:AB(第一个主机并不知道该物理地址 )。两个主机在同一个网络上。试说明ARP请求与回 答分组如何封装在以太网帧中。 解答 图21.5显示了ARP请求与回答分组。注意:此时ARP 数据字段是28个字节,而单个地址不适合用4字节表示 界限,这就是我们为什么不以4字节界限表示这些地址 21.9
21.9 一 个 主 机 的 IP 地址为 130.23.43.20 , 物 理 地 址 为 B2:34:55:10:22:10,它有一个分组想要发送给另一个主 机 , 其 IP 地址为 130.23.43.25 , 物理地址为 A4:6E:F4:59:83:AB(第一个主机并不知道该物理地址 ) 。两个主机在同一个网络上。试说明ARP请求与回 答分组如何封装在以太网帧中。 解答 图 21.5 显示了ARP请求与回答分组。注意:此时ARP 数据字段是28个字节,而单个地址不适合用4字节表示 界限,这就是我们为什么不以4字节界限表示这些地址 例 21.1
图21.521.1,ARP请求与回答分组 A 130.23.43.20 130.23.43.25 B B234:55:1022:10 A4:6E:F4:59:83:AB ARP Request 0x0001 0x0800 0x060x04 0x0001 0xB23455102210 130.23.43.20 0x000000000000 130.23.43.25 ARP Reply 0x0001 0x0800 0x060x04 0x0002 0xA46EF45983AB 130.23.43.25 0xB23455102210 130.23.43.20 Time Time 21.10
21.10 图 21.5 例21.1, ARP 请求与回答分组