首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ARP在更改端口IP地址时发送ARP请求

ARP在更改端口IP地址时发送ARP请求
EN

Network Engineering用户
提问于 2021-06-18 19:35:30
回答 1查看 121关注 0票数 1

在c7200上使用GNS3图像。我配置了两个路由器如下:

在进行arp调试之后,在分配ip地址之后,我看到每个路由器都发送一个免费的ARP响应包(这里只显示了R1的调试输出):

代码语言:javascript
复制
 ARP: flush cache for interface FastEthernet0/0, by 60093304
*Jun 18 23:05:41.419: ARP: flushing ARP entries for interface FastEthernet0/0
*Jun 18 23:05:41.427: IP ARP: sent rep src 192.168.1.1 ca01.2f98.0000,
                 dst 192.168.1.1 ffff.ffff.ffff FastEthernet0/0

查看一下show arp输出就会发现,在这一点上,两个路由器都没有了解对方的IP到ARP映射。据我所知,发送免费的ARP响应包是为了检查ip地址冲突。然而,为什么路由器不能使用免费的arp数据包将条目插入到arp表中呢?

接下来,在从R2 (以及相应的两个路由器都有对方的ip- to -mac条目)敲击R1后,我将R1's ip地址更改为192.168.1.3,R1's调试输出显示(去掉时间戳,每一行都是一个新的输出消息:

代码语言:javascript
复制
ARP: flush cache for interface FastEthernet0/0, by 60093304
IP ARP: sent req src 192.168.1.3 ca01.2f98.0000, dst 192.168.1.2 ca02.4314.0000 FastEthernet0/0
ARP: flushing ARP entries for interface FastEthernet0/0
IP ARP: sent rep src 192.168.1.3 ca01.2f98.0000, dst 192.168.1.3 ffff.ffff.ffff FastEthernet0/0
IP ARP: rcvd rep src 192.168.1.2 ca02.4314.0000, dst 192.168.1.3 FastEthernet0/0
IP ARP: creating entry for IP address: 192.168.1.2, hw: ca02.4314.0000

随后对R2的S arp表的检查表明,R2对新配置的地址有一个新的ARP条目,在上面的输出中,我们可以看到它作为对第2行请求的第5行的响应而收到。为什么第二行中的ARP请求被发送?

EN

回答 1

Network Engineering用户

回答已采纳

发布于 2021-06-18 19:52:53

然而,为什么路由器不能使用免费的arp数据包将条目插入到arp表中呢?

因为设备只应该更新现有的ARP表条目,所以除非设备是目标,否则不能为此创建新的条目。这在RFC 826,一种以太网地址解析协议中包含的伪代码中得到了解释:

代码语言:javascript
复制
 ?Do I have the hardware type in ar$hrd? Yes: (almost definitely)  
 [optionally check the hardware length ar$hln]   ?Do I speak the
 protocol in ar$pro?   Yes:
     [optionally check the protocol length ar$pln]
     Merge_flag := false
     If the pair  is
         already in my translation table, update the sender
         hardware address field of the entry with the new
         information in the packet and set Merge_flag to true.
     ?Am I the target protocol address?
     Yes:
       If Merge_flag is false, add the triplet  to
           the translation table.
       ?Is the opcode ares_op$REQUEST?  (NOW look at the opcode!!)
       Yes:
         Swap hardware and protocol fields, putting the local
             hardware and protocol addresses in the sender fields.
         Set the ar$op field to ares_op$REPLY
         Send the packet to the (new) target hardware address on
             the same hardware on which the request was received.

注意:“我是目标协议地址吗?”“不”的意思是放弃它。

为什么在第二行发送ARP请求?

路由器在更改其地址后正在更新其ARP表,这将为这些接口更新两个路由器的ARP表。

票数 2
EN
页面原文内容由Network Engineering提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://networkengineering.stackexchange.com/questions/74300

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档