
实验拓扑:
根据以下拓扑图,使用小凡模拟器搭建实验环境。
1在R1上配置iP地址:1.1.1.1. ,R2:1.1.1.2的配置和R1类似。
R1(config)#
R1(config)#int e0/0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
启用debug来查看arp协议数据的传输过程
R1(config-if)#do debug arp
ARP packet debugging is on
R1(config-if)#no shut
接口一旦启用之后,发现路由器会发起一个arp的广播,要查询的是1.1.1.1的mac地址,也就是自己的ip的mac地址。如下:
R1(config-if)#
*Mar 1 00:08:45.459: IP ARP: sent rep src 1.1.1.1 cc00.0bf8.0000,
dst 1.1.1.1 ffff.ffff.ffff Ethernet0/0
*Mar 1 00:08:45.463: IP ARP: sent rep src 1.1.1.1 cc00.0bf8.0000,
dst 1.1.1.1 ffff.ffff.ffff Ethernet0/0
R1(config-if)#
*Mar 1 00:08:47.443: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
*Mar 1 00:08:48.443: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up
查看arp 缓存,如下:
R1(config-if)#do sho arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 1.1.1.1 - cc00.0bf8.0000 ARPA Ethernet0/0
让R1 ping R2,结果是可以正常通信的。因为R1和R2是在相同的网段。Arp可以解析到对端的mac地址,icmp数据包才能正常的传输。如下
R1(config-if)#do ping 1.1.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.2, timeout is 2 seconds:
*Mar 1 00:11:06.151: IP ARP: creating incomplete entry for IP address: 1.1.1.2 interface Ethernet0/0
*Mar 1 00:11:06.151: IP ARP: sent req src 1.1.1.1 cc00.0bf8.0000,
dst 1.1.1.2 0000.0000.0000 Ethernet0/0
*Mar 1 00:11:06.475: IP ARP: rcvd rep src 1.1.1.2 cc00.0cc8.0000, dst 1.1.1.1 Ethernet0/0
.!!!! 这里由于arp解析占用了一个包的时间,所以icmp在默认时间里只发送了四个数据包。
Success rate is 80 percent (4/5), round-trip min/avg/max = 76/116/192 ms
查看arp缓存,如下
R1(config-if)#do sho arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 1.1.1.1 - cc00.0bf8.0000 ARPA Ethernet0/0
Internet 1.1.1.2 0 cc00.0cc8.0000 ARPA Ethernet0/0
R1(config-if)#
再次pingR2,这是由于arp缓存中存在ip地址对应的mac地址,路由器就不再发送arp广播报文。如下:
R1(config-if)#do ping 1.1.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/177/420 ms
R1(config-if)#do sho arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 1.1.1.1 - cc00.0bf8.0000 ARPA Ethernet0/0
Internet 1.1.1.2 13 cc00.0cc8.0000 ARPA Ethernet0/0
R2上同样启用debug命令来查看arp协议数据传输过程
*Mar 1 00:06:05.311: %SYS-5-CONFIG_I: Configured from console by console
R2#debug arp
ARP packet debugging is on
默认arp缓存中只有自己的ip地址对应的mac表
R2#sho arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 1.1.1.2 - cc00.0cc8.0000 ARPA Ethernet0/0
R2(config)#int e0/0
R2(config-if)#shut
*Mar 1 00:06:40.443: %LINK-5-CHANGED: Interface Ethernet0/0, changed state to administratively down
*Mar 1 00:06:41.443: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to down
关掉接口后,arp缓存中什么都没有,如下
R2(config-if)#do sho arp
R2(config-if)#no shut 启用接口
R2(config-if)#
*Mar 1 00:07:22.915: IP ARP: sent rep src 1.1.1.2 cc00.0cc8.0000,
dst 1.1.1.2 ffff.ffff.ffff Ethernet0/0
*Mar 1 00:07:22.919: IP ARP: sent rep src 1.1.1.2 cc00.0cc8.0000,
dst 1.1.1.2 ffff.ffff.ffff Ethernet0/0
R2(config-if)#
*Mar 1 00:07:24.903: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
*Mar 1 00:07:25.903: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up
R2(config-if)#
下面R2接收到两个arp包,是R1在重启接口是发送的广播arp包。
*Mar 1 00:08:21.955: IP ARP: rcvd rep src 1.1.1.1 cc00.0bf8.0000, dst 1.1.1.1 Ethernet0/0
*Mar 1 00:08:21.955: IP ARP: rcvd rep src 1.1.1.1 cc00.0bf8.0000, dst 1.1.1.1 Ethernet0/0
R2(config-if)#do sho arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 1.1.1.2 - cc00.0cc8.0000 ARPA Ethernet0/0
R2(config-if)#
下面是R1发送的arp请求解析1.1.1.2的mac地址的包。
*Mar 1 00:10:42.419: IP ARP: rcvd req src 1.1.1.1 cc00.0bf8.0000, dst 1.1.1.2 Ethernet0/0
R2给与R1一个arp的单播回应,如下*
Mar 1 00:10:42.419: IP ARP: creating entry for IP address: 1.1.1.1, hw: cc00.0bf8.0000
*Mar 1 00:10:42.423: IP ARP: sent rep src 1.1.1.2 cc00.0cc8.0000,
dst 1.1.1.1 cc00.0bf8.0000 Ethernet0/0
于是双方都学到了对应mac地址,如下
R2(config-if)#do sho arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 1.1.1.1 0 cc00.0bf8.0000 ARPA Ethernet0/0
Internet 1.1.1.2 - cc00.0cc8.0000 ARPA Ethernet0/0
R2(config-if)#
扩展2.
在R2上更改他的ip地址为2.2.2.2 ,并重启接口,继续ping 1.1.1.1 测试
R2(config-if)#no ip add
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config-if)#shut
*Mar 1 00:27:27.243: %LINK-5-CHANGED: Interface Ethernet0/0, changed state to administratively down
*Mar 1 00:27:28.243: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to down
R2(config-if)#do sho arp
R2(config-if)#no shut
R2(config-if)#
*Mar 1 00:27:32.343: IP ARP: sent rep src 2.2.2.2 cc00.0cc8.0000,
dst 2.2.2.2 ffff.ffff.ffff Ethernet0/0
*Mar 1 00:27:32.347: IP ARP: sent rep src 2.2.2.2 cc00.0cc8.0000,
dst 2.2.2.2 ffff.ffff.ffff Ethernet0/0
R2(config-if)#
*Mar 1 00:27:34.331: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
*Mar 1 00:27:35.331: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up
R2(config-if)#do sho arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 2.2.2.2 - cc00.0cc8.0000 ARPA Ethernet0/0
Ping测试失败,由于没有路由,同时路由器也不会发送arp广播。
R2(config-if)#do ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R2(config-if)#
3. 给R2指上一条静态路由,为1.1.1.1 ,让R2ping 1.1.1.1
R2(config)#ip route 1.1.1.0 255.255.255.0 e0/0
R2(config)#do sho ip rou
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
S 1.1.1.0 is directly connected, Ethernet0/0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Ethernet0/0
R2(config)#
R2(config)#do ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
*Mar 1 00:36:08.491: IP ARP: creating incomplete entry for IP address: 1.1.1.1 interface Ethernet0/0
*Mar 1 00:36:08.495: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0.
*Mar 1 00:36:10.491: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0.
*Mar 1 00:36:12.491: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0.
*Mar 1 00:36:14.491: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0.
*Mar 1 00:36:16.491: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0.
以上,在icmp时间里,arp发送了五个arp请求到1.1.1.1,但都没有得到回应,因为对端没有路由条目
Success rate is 0 percent (0/5)
R2(config)#do sho arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 2.2.2.2 - cc00.0cc8.0000 ARPA Ethernet0/0
R2(config)#
4给R2指条静态路由
R1(config)#ip route 2.2.2.0 255.255.255.0 e0/0
R1(config)#int e0/0
R1(config-if)#shut
R1(config-if)#no shut
R1(config-if)#
*Mar 1 00:41:57.527: %LINK-5-CHANGED: Interface Ethernet0/0, changed state to administratively down
*Mar 1 00:41:57.691: IP ARP: creating incomplete entry for IP address: 1.1.1.2 interface Ethernet0/0
*Mar 1 00:41:57.691: IP ARP: sent req src 1.1.1.1 cc00.0bf8.0000,
dst 1.1.1.2 0000.0000.0000 Ethernet0/0
*Mar 1 00:41:57.695: IP ARP throttled out the ARP Request for 1.1.1.2
*Mar 1 00:41:57.695: IP ARP throttled out the ARP Request for 1.1.1.2
*Mar 1 00:41:57.699: IP ARP throttled out the ARP Request for 1.1.1.2
*Mar 1 00:41:57.703: IP ARP: sent rep src 1.1.1.1 cc00.0bf8.0000,
dst 1.1.1.1 ffff.ffff.ffff Ethernet0/0
R1(config-if)#
*Mar 1 00:41:57.703: IP ARP: sent rep src 1.1.1.1 cc00.0bf8.0000,
dst 1.1.1.1 ffff.ffff.ffff Ethernet0/0
R1(config-if)#
*Mar 1 00:41:59.683: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
R1(config-if)#do sho arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 1.1.1.1 - cc00.0bf8.0000 ARPA Ethernet0/0
R1(config-if)#do ping 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
*Mar 1 00:42:44.547: IP ARP: creating incomplete entry for IP address: 2.2.2.2 interface Ethernet0/0
*Mar 1 00:42:44.551: IP ARP: sent req src 1.1.1.1 cc00.0bf8.0000,
dst 2.2.2.2 0000.0000.0000 Ethernet0/0
*Mar 1 00:42:44.927: IP ARP: rcvd rep src 2.2.2.2 cc00.0cc8.0000, dst 1.1.1.1 Ethernet0/0
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 64/80/104 ms
R1(config-if)#do sho arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 2.2.2.2 0 cc00.0cc8.0000 ARPA Ethernet0/0
Internet 1.1.1.1 - cc00.0bf8.0000 ARPA Ethernet0/0
R1(config-if)#
在r2重启接口发现
R2(config)#int e0/0
R2(config-if)#shut
R2(config-if)#no shut
R2(config-if)#
*Mar 1 00:47:41.483: %LINK-5-CHANGED: Interface Ethernet0/0, changed state to administratively down
*Mar 1 00:47:41.863: IP ARP: creating incomplete entry for IP address: 1.1.1.1 interface Ethernet0/0
*Mar 1 00:47:41.863: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0 这里有三个arp的请求包被接口堵塞,可能是由于接口链路还没起来的缘故吧?但不知道这种机制的原理及目的是什么?大家帮忙思考一下。
*Mar 1 00:47:41.867: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 00:47:41.867: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 00:47:41.871: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 00:47:41.875: IP ARP rep filtered src 1.1.1.1 cc00.0bf8.0000, dst 2.2.2.2 cc00.0cc8.0000 wrong cable, interface Ethernet0/0
R2(config-if)#
*Mar 1 00:47:41.875: IP ARP: sent rep src 2.2.2.2 cc00.0cc8.0000,
dst 2.2.2.2 ffff.ffff.ffff Ethernet0/0
*Mar 1 00:47:41.879: IP ARP: sent rep src 2.2.2.2 cc00.0cc8.0000,
dst 2.2.2.2 ffff.ffff.ffff Ethernet0/0
R2(config-if)#
*Mar 1 00:47:43.855: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
查看arp缓存,只有一个条目。
R2(config-if)#do sho arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 2.2.2.2 - cc00.0cc8.0000 ARPA Ethernet0/0
R2(config-if)#do sho ip int bri
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 2.2.2.2 YES manual up up
R2(config-if)#do sho arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 2.2.2.2 - cc00.0cc8.0000 ARPA Ethernet0/0
再次ping测试,
R2(config-if)#do ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
*Mar 1 00:52:04.059: IP ARP: creating incomplete entry for IP address: 1.1.1.1 interface Ethernet0/0
*Mar 1 00:52:04.059: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0
*Mar 1 00:52:04.423: IP ARP: rcvd rep src 1.1.1.1 cc00.0bf8.0000, dst 2.2.2.2 Ethernet0/0.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 60/114/228 ms
又重新学到了ip地址与mac地址的映射表
R2(config-if)#do sho arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 1.1.1.1 0 cc00.0bf8.0000 ARPA Ethernet0/0
Internet 2.2.2.2 - cc00.0cc8.0000 ARPA Ethernet0/0
R2(config-if)#ping 2.2.2.2
5,两边都删除静态路由,关闭路由功能,
R2(config)#no ip route 1.1.1.0 255.255.255.0 e0/0
R2(config)#
R2(config)#
R2(config)#do sho ip rou
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Ethernet0/0
R2(config)#
R2(config)#
R2(config)# no ip routing
R2(config)#
*Mar 1 01:02:35.615: IP ARP: sent rep src 2.2.2.2 cc00.0cc8.0000,
dst 2.2.2.2 ffff.ffff.ffff Ethernet0/0
R2(config)#
R2(config)#
R2(config)#int e0/0
R2(config-if)#shut
R2(config-if)#no
*Mar 1 01:02:56.183: %LINK-5-CHANGED: Interface Ethernet0/0, changed state to administratively down
*Mar 1 01:02:57.183: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to down
R2(config-if)#no shut
R2(config-if)#
*Mar 1 01:03:00.135: IP ARP: sent rep src 2.2.2.2 cc00.0cc8.0000,
dst 2.2.2.2 ffff.ffff.ffff Ethernet0/0
*Mar 1 01:03:00.135: IP ARP: sent rep src 2.2.2.2 cc00.0cc8.0000,
dst 2.2.2.2 ffff.ffff.ffff Ethernet0/0
R2(config-if)#
*Mar 1 01:03:02.123: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
*Mar 1 01:03:03.123: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up
R2(config-if)#do sho arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 2.2.2.2 - cc00.0cc8.0000 ARPA Ethernet0/0
R2(config-if)#do ping 1.1.1.1
在30秒的时间里,arp请求竟然持续发送了十几次,这是什么机制那?和window系统下的数据发送过程有点不同。
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
*Mar 1 01:04:14.171: IP ARP: creating incomplete entry for IP address: 1.1.1.1 interface Ethernet0/0
*Mar 1 01:04:14.171: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0
*Mar 1 01:04:15.175: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:16.175: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0
*Mar 1 01:04:17.175: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:17.175: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:18.175: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0.
*Mar 1 01:04:19.175: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:20.175: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0
*Mar 1 01:04:20.179: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:21.179: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:22.179: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0
*Mar 1 01:04:23.179: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:23.179: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:24.179: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0.
*Mar 1 01:04:25.179: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:26.179: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0
*Mar 1 01:04:26.183: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:27.183: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:28.183: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0
*Mar 1 01:04:29.183: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:29.183: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:30.183: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0.
*Mar 1 01:04:31.183: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:32.183: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0
*Mar 1 01:04:32.187: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:33.187: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:34.187: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0
*Mar 1 01:04:35.187: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:35.187: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:36.187: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0.
*Mar 1 01:04:37.187: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:38.187: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0
*Mar 1 01:04:38.191: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:39.191: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:40.191: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0
*Mar 1 01:04:41.191: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:41.191: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:42.191: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0.
Success rate is 0 percent (0/5)
R2(config-if)#
*Mar 1 01:04:43.191: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:04:44.191: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0
R2(config-if)#
6一端路由器指定对端ip地址为网关
R2(config)#do sho arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 2.2.2.2 - cc00.0cc8.0000 ARPA Ethernet0/0
R2(config)#do ping 1.1.1.1 r 1 发送一个icmp包测试
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
*Mar 1 01:14:42.619: IP ARP: creating incomplete entry for IP address: 1.1.1.1 interface Ethernet0/0
*Mar 1 01:14:42.619: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0
*Mar 1 01:14:43.623: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:14:44.623: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0
*Mar 1 01:14:45.623: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:14:45.623: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:14:46.623: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0.
Success rate is 0 percent (0/1)
R2(config)#
*Mar 1 01:14:47.623: IP ARP throttled out the ARP Request for 1.1.1.1
*Mar 1 01:14:48.623: IP ARP: sent req src 2.2.2.2 cc00.0cc8.0000,
dst 1.1.1.1 0000.0000.0000 Ethernet0/0
以上显示arp请求失败。查看缓存,同样没有解析到mac。但是windows系统下,这种情况是能够解析到ip地址对应的mac地址的。
R2(config)#do sho arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 1.1.1.1 0 Incomplete ARPA
Internet 2.2.2.2 - cc00.0cc8.0000 ARPA Ethernet0/0
R2(config)#
R2(config)#
R1(config)#do sho arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 1.1.1.1 - cc00.0bf8.0000 ARPA Ethernet0/0
R1(config)#
*Mar 1 01:15:06.655: IP ARP req filtered src 2.2.2.2 cc00.0cc8.0000, dst 1.1.1.1 0000.0000.0000 wrong cable, interface Ethernet0/0
R1(config)#
*Mar 1 01:15:08.615: IP ARP req filtered src 2.2.2.2 cc00.0cc8.0000, dst 1.1.1.1 0000.0000.0000 wrong cable, interface Ethernet0/0
R1(config)#
*Mar 1 01:15:10.563: IP ARP req filtered src 2.2.2.2 cc00.0cc8.0000, dst 1.1.1.1 0000.0000.0000 wrong cable, interface Ethernet0/0
R1(config)#
*Mar 1 01:15:12.599: IP ARP req filtered src 2.2.2.2 cc00.0cc8.0000, dst 1.1.1.1 0000.0000.0000 wrong cable, interface Ethernet0/0
R1(config)#
以上数据显示R1同样收到了arp的请求的数据,原因可能是接口直接把该arp请求数据丢弃了。相比windows主机是能够给与单播回应的。不知道这种原理是什么,我已经关闭了路由器的路由功能,路由器就相当于主机了,为什么这中机制和windows主机的机制不同那?????????
7路由器两边都互指对端的ip地址为网关
R1(config)#ip default-gateway 2.2.2.2
R1(config)#do ping 1.1.1.1 r 1
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!
Success rate is 100 percent (1/1), round-trip min/avg/max = 4/4/4 ms
R1(config)#do sho arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 1.1.1.1 - cc00.0bf8.0000 ARPA Ethernet0/0
R1(config)#do ping 1.1.1.1 r 3
Type escape sequence to abort.
Sending 3, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!
Success rate is 100 percent (3/3), round-trip min/avg/max = 4/5/8 ms
Ping测试成功了,但是arp缓存中怎么没有对端相应的mac地址那????也没有抓获到arp协议包。说明路由器没有发起arp广播。
那么这种icmp的数据又该怎么去封装及传输那???????????????
R1(config)#do sho arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 1.1.1.1 - cc00.0bf8.0000 ARPA Ethernet0/0
R1(config)#
整个过程,对交换机来说是完全透明的,它既看不到arp数据,又学不到两边的路由器的mac地址。
个人制作,与君共勉! |
|