注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 linux服务器被黑了
 帮助

3.4 RIP的汇总和不连续网络


2008-03-06 22:28:10
 标签:网络 rip 汇总   [推送到技术圈]

版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://sharkii.blog.51cto.com/325987/64472

 

3.4 RIP的汇总和不连续网络
 
实验连接图
提要描述
RIPv2中存在的是自动汇总,虽然可以简化了路由表的条目,但是如果出现了不连续网络这样的情况,就会丢失路由信息。所以在用RIPv2的时候直接可以毫不犹豫的关闭掉。而在RIP v1中存在的叫做边界路由的问题。   边界就是在有类的网络中才会出现的 一种汇总的现象,介乎于两个主类 。而不连续网络就是同一个主网络或子网被另一网络隔断。
实验目标:调试出自动汇总、手动汇总、边界汇总、不连续子网的现象,以及解决这些现象的办法。
基本配置
R1的配置
R2的配置
!
hostname R1
interface Serial1/1
ip address 12.1.1.1 255.255.255.0
no sh
clock rate 64000
!
Router rip
 Version 2
 Network 12.1.1.0
!
!
hostname R2
interface Serial1/0
ip address 12.1.1.2 255.255.255.0
no sh
!
interface Serial1/1
ip address 192.168.1.2 255.255.255.0
no sh
!
Router rip
Version 2
Network 12.1.1.0
Network 192.168.1.0
!
R3的配置
 
!
hostname R3
!
interface Loopback0
 ip address 10.1.1.1 255.255.255.0
!
interface Loopback1
 ip address 10.1.2.1 255.255.255.0
!
interface Loopback2
 ip address 10.1.3.1 255.255.255.0
!
interface Loopback3
 ip address 10.1.4.1 255.255.255.0
!
interface Serial1/0
ip address 192.168.1.3 255.255.255.0
no sh
clock rate 64000
!
router rip
version 2
network 10.1.1.0
network 10.1.2.0
network 10.1.3.0
network 10.1.4.0
network 192.168.1.0
!
 
↓调试配置及监测步骤↓
 
首先R1R2R3都已经运行了RIPv2
查看R1R2R3的路由表
 
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
对比前面没有关闭自动汇总,现在的路由表学到的全部是明细路由。等一些时间后再查看路由表,上面阴影的路由条目就会消失
 
当然我们也可以手动精确汇总,例如:把R310.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边界汇总不连续子网问题
 
R1的配置
R2的配置
!
hostname R1
interface Serial1/1
ip address 12.1.1.1 255.255.255.0
no sh
clock rate 64000
!
Router rip
 Network 12.1.1.0
!
!
hostname R2
interface Serial1/0
ip address 12.1.1.2 255.255.255.0
no sh
!
interface Serial1/1
ip address 192.168.1.2 255.255.255.0
no sh
!
Router rip
Network 12.1.1.0
Network 192.168.1.0
!
R3的配置
 
!
hostname R3
!
interface Serial1/0
ip address 192.168.1.3 255.255.255.0
no sh
clock rate 64000
!
router rip
network 192.168.1.0
!
 
 
1如果路由2边的主类网络号不相同的情况下,路由就会把一边的路由信息汇总转发出去
2如果路由2边的主类网络号相同的情况下,路由会不做汇总直接转发出去
 
现在看看在边界路由R2debug的情况
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
 
R2debug信息R3的路由表可以看到,R2在向R3发送路由信息时候,并没有把我们配置宣告的12.1.1.0/24网络通告给R3,而是通告主类网络12.0.0.0/8与上面RIPv2没有关闭自动汇总发送的情况一样这就是RIP发送路由更新跨越网络边界时,它会按照(ABC类)的掩码进行汇总,即边界汇总
 
现在我们看看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路由表时,更新的时间已经为49S12.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
 
出现上述的原因是R3looback 4接口是直连接口,接受来自相同