wireshark 抓包ARP分组

前言

从下图的报文数据的结构来看,ARP协议属于是网络层协议,因为它被封装在了以太网帧中(从包封装的角度来讲)。但从功能上来说,ARP是为了获得获取到MAC地址,所以也可以说是属于链路层协议。

目的地址是广播地址的请求报文

在这里插入图片描述
Who has 192.168.0.1? Tell 192.168.0.101。翻译过来就是,谁是192.168.0.1,请告诉我192.168.0.101。

从ARP的字段上看,7e:90:3c:47:04:0a这个设备和192.168.0.101绑定在了一起,它想知道192.168.0.1的MAC地址是什么,所以Target IP address放的是192.168.0.1,但只知道IP地址,链路层可不知道该哪儿传,所以帧的字段里,Destination放的是(ff:ff:ff:ff:ff:ff),即MAC广播地址。

这是个ARP请求报文。

可以看到7e:90:3c:47:04:0a有点冗余,在ARP协议字段和帧的字段中,都出现了。

目的地址不是广播地址的请求报文

在这里插入图片描述
根据[RFC 826]的解释:

Another alternative is to have a daemon perform the timeouts. After a suitable time, the daemon considers removing an entry. It first sends (with a small number of retransmissions if needed) an address resolution packet with opcode REQUEST directly to the Ethernet address in the table. If a REPLY is not seen in a short amount of time, the entry is deleted. The request is sent directly so as not to bother every station on the Ethernet. Just forgetting entries will likely cause useful information to be forgotten, which must be regained.

当本机的ARP转发表的其中一个表项将要过期的时候,它会提前会去询问,这个表项里的mac地址,问它是否还拥有表项对应的IP地址。这样,不用以太网帧的目的MAC地址不用是广播MAC地址,只需要是表项里的MAC地址就行了。

响应报文

在这里插入图片描述
192.168.0.1 is at 24:69:68:82:8d:d6。翻译过来就是,192.168.0.1 分配给了 24:69:68:82:8d:d6。

这是个ARP响应报文,因为之前有 请求报文,所以响应报文不需要广播了,谁询问的,就发给谁。

猜你喜欢

转载自blog.csdn.net/anlian523/article/details/121503791