CCNP-27 管理距离(BSCI)

本文介绍了一个关于管理距离的实验配置案例,通过调整管理距离来控制路由表选路,确保数据包能够选择更优路径。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >


CCNP-27 管理距离

实验拓扑:
试验要求:R1R2之间起OSPF路由协议R1R3R4R2之间起RIPv2路由协议,然后在R1R2上重发布RIPv2路由协议。
试验目的:掌握在路由重分布的时候管理距离的用法和配置方法。

试验配置:
R1
R1(config)#int s1/0
R1(config-if)#ip add 199.99.1.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shu
R1(config-if)#exit
R1(config)#int s1/1
R1(config-if)#ip add 199.99.2.1 255.255.255.0
R1(config-if)#clock rate 64000
R1(config-if)#no shu
R1(config-if)#exit
R1(config)#int loop0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#router ospf 100
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 199.99.1.0 0.0.0.255 area 0
R1(config-router)#redistribute rip metric 20 subnets
R1(config-router)#exit
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#network 199.99.2.0
R1(config-router)#redistribute ospf 100 metric 2
R1(config-router)#no auto-summary
R1(config-router)#end
 
R2
R2(config)#int s1/0
R2(config-if)#ip add 199.99.1.2 255.255.255.0
R2(config-if)#no shu
R2(config-if)#exit
R2(config)#int s1/1
R2(config-if)#ip add 199.99.3.1 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shu
R2(config-if)#exit
R2(config)#int loop0
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config-if)#exit
R2(config)#router ospf 100
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 199.99.1.0 0.0.0.255 area 0
R2(config-router)#redistribute rip metric 20 subnets
R2(config-router)#exit
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#network 199.99.3.0
R2(config-router)#no auto-summary
R2(config-router)#end
 
R3
R3(config)#int s1/1
R3(config-if)#ip add 199.99.2.2 255.255.255.0
R3(config-if)#no shu
R3(config-if)#exit
R3(config)#int s1/0
R3(config-if)#ip add 199.99.4.1 255.255.255.0
R3(config-if)#clock rate 64000
R3(config-if)#no shu
R3(config-if)#exit
R3(config)#router rip
R3(config-router)#version 2
R3(config-router)#network 199.99.2.0
R3(config-router)#network 199.99.4.0
R3(config-router)#end
 
R4
R4(config)#int s1/1
R4(config-if)#ip add 199.99.3.2 255.255.255.0
R4(config-if)#no shu
R4(config-if)#exit
R4(config)#int s1/0
R4(config-if)#ip add 199.99.4.2 255.255.255.0
R4(config-if)#no shu
R4(config-if)#exit
R4(config)#router rip
R4(config-router)#version 2
R4(config-router)#network 199.99.3.0
R4(config-router)#network 199.99.4.0
R4(config-router)#end
上面的为基本配置,配置完成后我们在R1R2上查看一下路由表:
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static 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
O E2 199.99.3.0/24 [110/20] via 199.99.1.2, 00:17:52, Serial1/0
C    199.99.2.0/24 is directly connected, Serial1/1
C    199.99.1.0/24 is directly connected, Serial1/0
O E2 199.99.4.0/24 [110/20] via 199.99.1.2, 00:08:26, Serial1/0
 
R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is not set
 
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback0
C    199.99.3.0/24 is directly connected, Serial1/1
O E2 199.99.2.0/24 [110/20] via 199.99.1.1, 00:04:09, Serial1/0
C    199.99.1.0/24 is directly connected, Serial1/0
O E2 199.99.4.0/24 [110/20] via 199.99.1.1, 00:04:09, Serial1/0
 
路由表里只有直连和O E2路由,但是我们通过拓扑图可以发现199.99.4.0/24这条路由如果用RIP来通告的话,会更好,因为R3RIPv2R1通告199.99.4.0/24网段,R4RIPv2R2通告199.99.4.0/24网段,这样数据包会少走许多弯路,而路由表选择路由的时候,如果有两种路由协议都有到达某个目的地的路又,那么路由器会选择管理距离较小的为最佳的,这样的话我们可以通过修改它的管理距离来控制路由表选路,如:
R1(config)#access-list 10 permit 199.99.4.0 0.0.0.255
R1(config)#router ospf 100
R1(config-router)#distance 125 199.99.1.2 255.255.255.0 10
R1(config-router)#end
首先定义一条ACL,这是来为后面修改管理距离定义感兴趣的数据的,然后在OSPF配置模式下,定义从199.99.1.2/24这个地址学习到的复合ACL 10的路由的管理距离设置为125OSPF默认为110RIP默认为120),这样定义完后,199.99.4.0/24这个从OSPF外部路由的管理距离就被设置为125了,因为它大于RIP的默认管理距离,所以在选择到达199.99.4.0/24网段的时候会采用RIP通告的路由。同理,在R2上设置如下:
R2(config)#access-list 10 permit 199.99.4.0 0.0.0.255
R2(config)#router ospf 100
R2(config-router)#distance 125 199.99.1.1 255.255.255.0 10
R2(config-router)#end
这样配置完成后,我们再来看看两台路由器的路由表有什么变化:
R1#show ip route  
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static 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
O E2 199.99.3.0/24 [110/20] via 199.99.1.2, 00:00:10, Serial1/0
C    199.99.2.0/24 is directly connected, Serial1/1
C    199.99.1.0/24 is directly connected, Serial1/0
R    199.99.4.0/24 [120/1] via 199.99.2.2, 00:00:06, Serial1/1
 
R2#show ip route  
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route
 
Gateway of last resort is not set
 
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback0
C    199.99.3.0/24 is directly connected, Serial1/1
O E2 199.99.2.0/24 [110/20] via 199.99.1.1, 00:00:04, Serial1/0
C    199.99.1.0/24 is directly connected, Serial1/0
R    199.99.4.0/24 [120/1] via 199.99.3.2, 00:00:04, Serial1/1
 
原来到199.99.4.0/24O E2路由现在变成R路由了。

实验总结:掌握管理距离在路由重发布时候的作用和配置方法

















本文转自loveme2351CTO博客,原文链接: http://blog.51cto.com/loveme23/50797,如需转载请自行联系原作者





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值