<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
3.4 RIP
的汇总和不连续网络
| |
| |
实验连接图
| |
<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />
| |
提要描述
| |
在
RIPv2
中存在的是自动汇总,虽然可以简化了路由表的条目,但是如果出现了不连续网络这样的情况,就会丢失路由信息。所以在用
RIPv2
的时候直接可以毫不犹豫的关闭掉。而在
RIP v1
中存在的叫做边界路由的问题。
边界就是在有类的网络中才会出现的
一种汇总的现象,介乎于两个主类
。而不连续网络就是同一个主网络或子网被另一网络隔断。
实验目标:
调试出自动汇总、手动汇总、边界汇总、不连续子网的现象,以及解决这些现象的办法。
| |
基本配置
| |
R1
的配置
|
R2
的配置
|
!
hostname R1
interface Serial1/1
ip address <?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />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
!
|
|
↓调试配置及监测步骤↓
|
首先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
的边界汇总和不连续子网问题
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边的主类网络号相同的情况下,路由会不做汇总直接转发出去。
现在看看在边界路由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接口是直连接口,接受来自相同12.0.0.0的更新时,它会丢弃。只选择来自直连接口的路由。
遇到这样的问题,我们可以通过设置辅助地址(第二地址)来解决,辅助地址要与不连续网络位于同一个主网络内,并且使用相同的子网掩码。下面我们在R2和R3上设置。
R2(config)#int s1/1
R2(config-if)#ip address 12.1.3.1 255.255.255.0 secondary
R3(config)#int s1/0
R3(config-if)#ip address 12.1.3.2 255.255.255.0 secondary
再次观察R3的debug信息和路由表
R3#debug ip rip
*Mar 6 22:13:47.587: RIP: received v1 update from 192.168.1.2 on Serial1/0
*Mar 6 22:13:47.587: 12.0.0.0 in 1 hops
*Mar 6 22:13:47.587: RIP: received v1 update from 12.1.3.1 on Serial1/0
*Mar 6 22:13:47.591: 12.1.1.0 in 1 hops
R3#show ip route
12.0.0.0/24 is subnetted, 4 subnets
R 12.1.1.0 [120/1] via 12.1.3.1, 00:00:10, Serial1/0
R 12.0.0.0 [120/1] via 192.168.1.2, 00:00:10, Serial1/0
C 12.1.3.0 is directly connected, Serial1/0
C 12.1.2.0 is directly connected, Loopback4
C 192.168.1.0/24 is directly connected, Serial1/0
可以看到现在的R3已经有了12.1.1.0/24的路由条目,当然R1也学到了12.1.3.0/24的路由条目
R1#show ip route
12.0.0.0/24 is subnetted, 2 subnets
C 12.1.1.0 is directly connected, Serial1/1
R 12.1.3.0 [120/1] via 12.1.1.2, 00:00:12, Serial1/1
R 192.168.1.0/24 [120/1] via 12.1.1.2, 00:00:12, Serial1/1
测试一下R1和R3的互通性
R1#ping 192.168.1.3
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.3, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 52/86/156 ms
R3#ping 12.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 64/98/132 ms
留心观察会发现辅助地址不但解决了不连续网络的问题,而且也解决了边界汇总的问题。所以很多时候不连续网络和边界汇总是同时出现的。
转载于:https://blog.51cto.com/sharkii/64472