您的位置:首页 > 其它

CCNP-27 管理距离(BSCI)

2007-11-16 13:16 204 查看

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
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/24的O E2路由现在变成R路由了。

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

本文出自 “★Beckham~23” 博客,请务必保留此出处http://loveme23.blog.51cto.com/7891/50797
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: