3.4 RIP的汇总和不连续网络
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://sharkii.blog.51cto.com/325987/64472 | ||||||||||||||||||||||||||||||||
首先R1、R2、R3都已经运行了RIPv2
查看R1、R2、R3的路由表
R1#show ip route
R 10.0.0.0/8 [120/2] via 12.1.1.2, 00:00:23, Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/1
R 192.168.1.0/24 [120/1] via 12.1.1.2, 00:00:23, Serial1/1
R2#show ip route
R 10.0.0.0/8 [120/1] via 192.168.1.3, 00:00:22, Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/0
C 192.168.1.0/24 is directly connected, Serial1/1
R3#show ip route
10.0.0.0/24 is subnetted, 4 subnets
C 10.1.3.0 is directly connected, Loopback2
C 10.1.2.0 is directly connected, Loopback1
C 10.1.1.0 is directly connected, Loopback0
C 10.1.4.0 is directly connected, Loopback3
R 12.0.0.0/8 [120/1] via 192.168.1.2, 00:00:08, Serial1/0
C 192.168.1.0/24 is directly connected, Serial1/0
由以上三个路由表可以看到,学到的路由全部都是自动汇总的。
下面我们关闭自动汇总看看:
R1(config)#router rip
R1(config-router)#no auto-summary
R2(config)#router rip
R2(config-router)#no auto-summary
R3(config)#router rip
R3(config-router)#no auto-summary
现在再看看各个路由表的情况:
R1#show ip route
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
R 10.1.3.0/24 [120/2] via 12.1.1.2, 00:00:21, Serial1/1
R 10.1.2.0/24 [120/2] via 12.1.1.2, 00:00:21, Serial1/1
R 10.1.1.0/24 [120/2] via 12.1.1.2, 00:00:21, Serial1/1
R 10.0.0.0/8 [120/2] via 12.1.1.2, 00:00:21, Serial1/1
R 10.1.4.0/24 [120/2] via 12.1.1.2, 00:00:21, Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/1
R 192.168.1.0/24 [120/1] via 12.1.1.2, 00:00:21, Serial1/1
R2#show ip route
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
R 10.1.3.0/24 [120/1] via 192.168.1.3, 00:00:17, Serial1/1
R 10.1.2.0/24 [120/1] via 192.168.1.3, 00:00:17, Serial1/1
R 10.1.1.0/24 [120/1] via 192.168.1.3, 00:00:17, Serial1/1
R 10.0.0.0/8 [120/1] via 192.168.1.3, 00:02:08, Serial1/1
R 10.1.4.0/24 [120/1] via 192.168.1.3, 00:00:17, Serial1/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial1/0
C 192.168.1.0/24 is directly connected, Serial1/1
R3#show ip route
10.0.0.0/24 is subnetted, 4 subnets
C 10.1.3.0 is directly connected, Loopback2
C 10.1.2.0 is directly connected, Loopback1
C 10.1.1.0 is directly connected, Loopback0
C 10.1.4.0 is directly connected, Loopback3
12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 12.1.1.0/24 [120/1] via 192.168.1.2, 00:00:14, Serial1/0
R 12.0.0.0/8 [120/1] via 192.168.1.2, 00:02:04, Serial1/0
C 192.168.1.0/24 is directly connected, Serial1/0
对比前面没有关闭自动汇总,现在的路由表学到的全部是明细路由。等一些时间后再查看路由表,上面阴影的路由条目就会消失。
当然我们也可以手动精确汇总,例如:把R3的10.1.1.1汇总成10.1.0.0/16
R3(config)#int s1/0
R3(config-if)#ip summary-address rip 10.1.0.0 255.255.0.0
R2#show ip route
10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
R 10.1.3.0/24 [120/1] via 192.168.1.3, 00:00:16, Serial1/1
R 10.1.2.0/24 [120/1] via 192.168.1.3, 00:00:16, Serial1/1
R 10.1.1.0/16 [120/1] via 192.168.1.3, 00:00:16, Serial1/1
R 10.1.1.0/24 [120/1] via 192.168.1.3, 00:00:16, Serial1/1
R 10.1.4.0/24 [120/1] via 192.168.1.3, 00:00:16, Serial1/1
可以看到R2多出了一条10.1.1.0/16的路由,这就是手动汇总的精确路由
下面我们看看各路由器运行RIPv1的边界汇总和不连续子网问题
1:如果路由2边的主类网络号不相同的情况下,路由就会把一边的路由信息汇总转发出去。
2:如果路由2边的主类网络号相同的情况下,路由会不做汇总直接转发出去。
现在看看在边界路由R2上debug的情况
R2#debug ip rip
R2#
*Mar 6 21:19:14.887: RIP: sending v1 update to 255.255.255.255 via Serial1/1 (192.168.1.2)
*Mar 6 21:19:14.887: RIP: build update entries
*Mar 6 21:19:14.891: network 12.0.0.0 metric 1
再看看R3的路由表:
R3# show ip route
R 12.0.0.0/8 [120/1] via 192.168.1.2, 00:00:26, Serial1/0
C 192.168.1.0/24 is directly connected, Serial1/0
由R2的debug信息和R3的路由表可以看到,R2在向R3发送路由信息时候,并没有把我们配置宣告的12.1.1.0/24网络通告给R3,而是通告主类网络12.0.0.0/8,与上面RIPv2没有关闭自动汇总发送的情况一样。这就是RIP发送路由更新跨越网络边界时,它会按照(A、B、C类)的掩码进行汇总,即边界汇总。
现在我们看看R3上配置一个loopback4接口,地址为12.1.2.1/24,使它与12.1.1.0/24形成一个不连续网络的情况。且打开debug观察。
R3(config)#interface loopback 4
R3(config-if)#ip address 12.1.2.1 255.255.255.0
R3#debug ip rip
R3#
*Mar 6 21:40:51.267: RIP: sending v1 update to 255.255.255.255 via Serial1/0 (192.168.1.3)
*Mar 6 21:40:51.267: RIP: build update entries - suppressing null update
R3#
*Mar 6 21:41:00.051: RIP: received v1 update from 192.168.1.2 on Serial1/0
*Mar 6 21:41:00.055: 12.0.0.0 in 1 hops
R3#show ip route
12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 12.0.0.0/8 [120/1] via 192.168.1.2, 00:00:49, Serial1/0
C 12.1.2.0/24 is directly connected, Loopback4
C 192.168.1.0/24 is directly connected, Serial1/0
由debug信息可以看到R3仍然一直收到来自R1的更新,但当我们查看R3路由表时,更新的时间已经为49S,12.0.0.0/8这条路由已经没有再周期更新了,过一些时间就出现possibly down。
R3#show ip route
12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
R 12.0.0.0/8 is possibly down,routing via 192.168.1.2, Serial1/0
C 12.1.2.0/24 is directly connected, Loopback4
C 192.168.1.0/24 is directly connected, Serial1/0
大概4分钟之后,在R3的路由表就看不到R1通告过来的路由条目。
R3#show ip route
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.2.0 is directly connected, Loopback4
C 192.168.1.0/24 is directly connected, Serial1/0
出现上述的原因是R3的looback 4接口是直连接口,接受来自相同 | ||||||||||||||||||||||||||||||||



