2010-10-08
 
实验目的:
  1. 了解水平分割的原理及作用
 
 什么是水平分割?
水平分割是在距离矢量路由协议中最常用的避免环路发生的解决方案之一。产生环路的一种情况是:路由器A将从路由器B学习到的路由信息又告诉给了路由器B。最终,路由器B认为通过路由器A能够到达目标网络,路由器A认为通过路由器B能够到达目标网络。路由数据包的时候,数据将在两个路由器间不停地循环,直至TTL的值为0,将此数据包丢弃。水平分割的思想就是:在路由信息传送过程中,不再把路由信息发送到接收到此路由信息的接口上。从而在一定程度上避免了环路的产生。
 
  1. 了解在NBMA环境中的不足(下篇中介绍,)
 
测试使用软件:Cisco Packet Tracer
 
Figure:
路由配置:
 
路由A:
interface Loopback0
 ip address 10.0.1.1 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.1.1 255.255.255.0
 duplex full
 speed auto
!
interface Serial2/0
 ip address 192.168.0.1 255.255.255.0
 no ip split-horizon
 encapsulation frame-relay
 frame-relay interface-dlci 100
!
router rip
 version 2
 network 192.168.0.0
 network 192.168.1.0

路由B:
interface Loopback0
 ip address 10.0.1.2 255.255.255.255
!
interface FastEthernet0/0
 ip address 192.168.2.1 255.255.255.0
 duplex full
 speed auto
!
interface Serial2/0
 ip address 192.168.0.2 255.255.255.0
 no ip split-horizon
 encapsulation frame-relay
 frame-relay interface-dlci 200
!
router rip
 version 2
 network 192.168.0.0
 network 192.168.2.0
**************************************************************************
正常连接及工作正常时的路由表(未启用split horizon):
A#show ip route
     10.0.0.0/32 is subnetted, 1 subnets
C       10.0.1.1 is directly connected, Loopback0
C    192.168.0.0/24 is directly connected, Serial2/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
R    192.168.2.0/24 [120/1] via 192.168.0.2, 00:00:25, Serial2/0
 
B#show ip route
     10.0.0.0/32 is subnetted, 1 subnets
C       10.0.1.2 is directly connected, Loopback0
C    192.168.0.0/24 is directly connected, Serial2/0
R    192.168.1.0/24 [120/1] via 192.168.0.1, 00:00:18, Serial2/0
C    192.168.2.0/24 is directly connected, FastEthernet0/0
 
为了看到效果,我将路由AF0/0连线移走,此时路由A将会从路由B中学会到,去192.168.1.0/24这个网段的路由是指向路由Bserial 2/0口,即192.168.0.2,而路由B的路由表中会显示,去到此网段的路由是指向192.168.0.1的,此时会导致路由环路,如下:
 
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to down(当移走连线时的提示)
A>enable
A#show ip route
     10.0.0.0/32 is subnetted, 1 subnets
C       10.0.1.1 is directly connected, Loopback0
C    192.168.0.0/24 is directly connected, Serial2/0
R    192.168.1.0/24 [120/2] via 192.168.0.2, 00:00:17, Serial2/0
R    192.168.2.0/24 [120/1] via 192.168.0.2, 00:00:17, Serial2/0
 
B#show ip route
     10.0.0.0/32 is subnetted, 1 subnets
C       10.0.1.2 is directly connected, Loopback0
C    192.168.0.0/24 is directly connected, Serial2/0
R    192.168.1.0/24 [120/1] via 192.168.0.1, 00:00:38, Serial2/0
C    192.168.2.0/24 is directly connected, FastEthernet0/0
 
启用split horizon命令,配置路由B相同,
A(config)#interface serial 2/0
A(config-if)#ip split-horizon
 
为了验证split horizon的作用,我在路由A,B中启用split horizon ,再次将路由AF0/0连接线移走,看看路由表有什么变化,如下图,将会发现路由A中未学习到路由192.168.1.0,就是说启用split horizon后,路由B不会把从路由A接口serial 2/0学习到的路由回传给路由Aserial 2/0,从而避免环路的产生。
 
 
 
 
Alan