实验 RIPv2的手工汇总_RIPv2 

1》配置路由器R1
R1(concfig)#router rip
R1  (config-router)#version 2
R1  (config-router)#no auto-summary
R1  (config-router)#network 1.0.0.0
R1  (config-router)#network 192.168.12.0

2》用同样的方法开启R2  R3  R4的RIP进程
3》调试
Router#show ip 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, 4 subnets
R       4.4.0.0 [120/3] via 192.168.12.2, 00:00:01, Serial0/3/0
R       4.4.1.0 [120/3] via 192.168.12.2, 00:00:01, Serial0/3/0
R       4.4.2.0 [120/3] via 192.168.12.2, 00:00:01, Serial0/3/0
R       4.4.3.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的路由表中有R4的4条环回接口的明细路由。
而我们仔细分析过以后,其实这四条路由可以汇总成一条路由,这样可以减小路由条目的个数,从而减小路由表,提高路由器的工作效率。所以我们应该在R4上做一下路由器的手工汇总。

4》手工汇总
R4(config)#router rip
R4(confit-router)#version 2
R4(confit-router)#no auto-summary
R4(confit-router)#network 192.168.34.0
R4(confit-router)#network 4.0.0.0
R4(config)#interface f0/3/0
R4(config-if)#ip summary-address rip 4.4.0.0 255.255.252.0

5》执行完手工汇总以后的调试结果
R1#show ip 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
R    4.0.0.0/8 [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
从输出的结果可以看出,执行完收工汇总以后上面的四条明细路由合成了一条,也达到了相同的效果。
注意:PT中RIPv2协议不承认执行收工汇总的命令,我是用自动汇总“”auto-summary"来实现的。但道理都是一样的。
【思考】若将R4上4个环回口的地址分别改成192.168.96.4/24,192.168.97.4/24,192.168.98.4/24,192.168.99.4/24   在S0/3/0接口下还能实现路由汇总吗?
    汇总后路由器会提示:
"summary mask must be greater or equal to major net"
显示的信息表明汇总后的掩码长度必须要大于或者等于主类网络的掩码长度,因为22《24,所以不能汇总
      所以RIPv2不支持CIDR汇总,但是可以传递CIDR汇总
      解决的方案是
    (1)用静态路由发布被汇总的路由
      R4(config)#ip route 192.168.96.0 255.255.252.0 null0
      (2)将静态路由重分布到RIP网络中
      R4(config)#router rip
      R4(config-router)#redistribute static    将静态路由重分布到RIP路由协议中
这样就可以达到效果!