R1#show ip route //查看路由表。 Codes: C - connected, S - static, I - IGRP, 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, E - EGP i - IS-IS, 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 C 1.1.1.0 is directly connected, Loopback0 4.0.0.0/24 is subnetted, 1 subnets R 4.4.4.0 [120/3] via 192.168.12.2, 00:00:01, Serial0/3/0 C 192.168.12.0/24 is directly connected, Serial0/3/0 R 192.168.23.0/24 [120/1] via 192.168.12.2, 00:00:01, Serial0/3/0 R 192.168.34.0/24 [120/2] via 192.168.12.2, 00:00:01, Serial0/3/0 R1#
通过:R 4.4.4.0 [120/3] via 192.168.12.2, 00:00:01, Serial0/3/0
可以看出RIP Version2 在通告网络时是携带子网信息的、 —————————————————————————————————————— R1#show ip protocols Routing Protocol is "rip" Sending updates every 30 seconds, next due in 18 seconds Invalid after 180 seconds, hold down 180, flushed after 240 Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Redistributing: rip Default version control: send version 2, receive 2 //RIPv2在默认情况下只接收和发送版本2的路由更新。 *可以通过命令”ip rip send version”和”ip rip receive version”来控制在路由器接口上接收和发送的版本。例如,在s0/3/0接口上接收版本1和版本2的路由更新,但是只发送版本2的路由更新,配置如下 //R1(config)#interface s0/3/0 R1(config-if)#ip rip send version 2 R1(config-if)#ip rip receive version 1 2 //
Interface Send Recv Triggered RIP Key-chain Loopback0 2 2 Serial0/3/0 2 2 Automatic network summarization is not in effect Maximum path: 4 Routing for Networks: 1.0.0.0 192.168.12.0 Passive Interface(s): Routing Information Sources: Gateway Distance Last Update 192.168.12.2 120 00:00:16 Distance: (default is 120) R1# ———————————————————————————————————— *下面我们说RIPv2手工汇总:
R4#configure terminal Enter configuration commands, one per line. End with CNTL/Z. R4(config)#router rip R4(config-router)#version 2 R4(config-router)#no auto-summary R4(config-router)#network 192.168.34.0 R4(config-router)#network 4.0.0.0 //通告所有的loopback口 R4(config-router)#exit
这一步的时候我们没有进行手工汇总、然后我们进入R1查看下路由表:
R1#show ip route 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
C 192.168.12.0/24 is directly connected, Serial0/0 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 4.0.0.0/24 is subnetted, 4 subnets R 4.4.0.0 [120/3] via 192.168.12.2, 00:00:18, Serial0/0 R 4.4.1.0 [120/3] via 192.168.12.2, 00:00:18, Serial0/0 R 4.4.2.0 [120/3] via 192.168.12.2, 00:00:18, Serial0/0 R 4.4.3.0 [120/3] via 192.168.12.2, 00:00:18, Serial0/0 R 192.168.23.0/24 [120/1] via 192.168.12.2, 00:00:18, Serial0/0 R 192.168.34.0/24 [120/2] via 192.168.12.2, 00:00:18, Serial0/0 R1#
*(如果想取消路由汇总的话就在命令前加上”no”例:no ip summary-address rip 4.4.0.0 255.255.252.0 同样,如果在配置中我们想取消哪个命令重新配置的话就在命令前加no就行)
然后我们查看下R1上的路由表:
R1#show ip route 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
C 192.168.12.0/24 is directly connected, Serial0/0 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 4.0.0.0/22 is subnetted, 1 subnets R 4.4.0.0 [120/3] via 192.168.12.2, 00:00:08, Serial0/0 R 192.168.23.0/24 [120/1] via 192.168.12.2, 00:00:08, Serial0/0 R 192.168.34.0/24 [120/2] via 192.168.12.2, 00:00:08, Serial0/0 R1# 以上输出表明R1收到了路由汇总、同样R2、R3也会收到。 ——————————————————————————————————————
我配置下证实下R4的配置如下: R4#config terminal Enter configuration commands, one per line. End with CNTL/Z. R4(config)#router rip R4(config-router)#version 2 R4(config-router)#no auto-summary R4(config-router)#net 192.168.96.0 //通告loopback口 R4(config-router)#net 192.168.97.0 R4(config-router)#net 192.168.98.0 R4(config-router)#net 192.168.99.0 R4(config-router)#exit R4(config)#inter s0/0 R4(config-if)#ip summary-address rip 192.168.96.0 255.255.252.0 Summary mask must be greater or equal to major net R4(config-if)# 以上输出路由器提示是汇总失败:“Summary mask must be greater or equal to major net ”这句显示的提示信息表明汇总后的掩码升序必须要大于或等主类网络的掩码长度,因为”22<24”,所以不能汇总。 *所以,RIPv2不支持CIDR汇总,但是可以传递CIDR汇总。 解决方案如下: R4(config)#ip route 192.168.96.0 255.255.252.0 null 0 //用静态路由发布被汇总的路由“0”的一个名字、如果再有需要的话就可以写1、2、3、之类的。 R4(config)#router rip R4(config-router)#version 2 R4(config-router)#redistribute static //将静态路由重分布到RIP网络中 R4(config-router)#no net 192.168.96.0 //取消loopback口的网络通告。 R4(config-router)#no net 192.168.97.0 R4(config-router)#no net 192.168.98.0 R4(config-router)#no net 192.168.99.0 R4(config-router)#
然后我们去R1上查看路由表: R1#show ip route 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
C 192.168.12.0/24 is directly connected, Serial0/0 1.0.0.0/24 is subnetted, 1 subnets C 1.1.1.0 is directly connected, Loopback0 R 192.168.23.0/24 [120/1] via 192.168.12.2, 00:00:00, Serial0/0 R 192.168.34.0/24 [120/2] via 192.168.12.2, 00:00:00, Serial0/0 R 192.168.96.0/22 [120/3] via 192.168.12.2, 00:00:00, Serial0/0 R1# 通过这个实验的以上输出表示RIP Version2是可以传递CIDR汇总信息的。