CCNP-27 管理距离(BSCI)

简介:


CCNP-27 管理距离

实验拓扑:
试验要求: R1 R2 之间起 OSPF 路由协议 R1 R3 R4 R2 之间起 RIPv2 路由协议,然后在 R1 R2 上重发布 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
上面的为基本配置,配置完成后我们在 R1 R2 上查看一下路由表:
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 来通告的话,会更好,因为 R3 RIPv2 R1 通告 199.99.4.0/24 网段, R4 RIPv2 R2 通告 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 的路由的管理距离设置为 125 OSPF 默认为 110 RIP 默认为 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
   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/24 O E2 路由现在变成 R 路由了。

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

















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





相关文章
|
网络协议 网络虚拟化 网络架构
|
网络协议 网络架构
|
网络协议 网络架构
|
网络协议 网络架构
|
网络协议 数据库
|
网络协议 网络架构
|
网络协议 网络架构
|
网络协议 网络架构