且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

CCNP-21 路由重发布1(BSCI)

更新时间:2022-10-03 12:13:32

CCNP-21 路由重发布1

实验拓扑:
CCNP-21 路由重发布1(BSCI)
试验要求:R1R2运行RIPR3R2之间运行OSPF,要求在R2上配置路由重发布,使R1能够学习到R3的路由,同样R3能够学到R1上的路由。并且配置汇总路由。
试验目的:掌握路由重发布的基本配置与在配置路由重发布之前应该注意的地方。

试验配置:
R1
R1(config)#int s1/0
R1(config-if)#ip add 199.99.1.2 255.255.255.0
R1(config-if)#no shu
R1(config-if)#exit
R1(config)#int loop0
R1(config-if)#ip add 192.168.1.1 255.255.255.224
R1(config-if)#exit
R1(config)#int loop1
R1(config-if)#ip add 192.168.1.33 255.255.255.224
R1(config-if)#exit
R1(config)#int loop2
R1(config-if)#ip add 192.168.1.65 255.255.255.224
R1(config-if)#exit
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#network 199.99.1.0
R1(config-router)#network 192.168.1.0
R1(config-router)#network 192.168.1.32
R1(config-router)#network 192.168.1.64
R1(config-router)#no auto-summary
R1(config-router)#exit
 
R2
R2(config)#int s1/0
R2(config-if)#ip add 199.99.1.1 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shu
R2(config-if)#exit
R2(config)#int s1/1
R2(config-if)#ip add 199.99.2.1 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shu
R2(config-if)#exit
R2(config)#router rip
R2(config-router)#network 199.99.1.0
R2(config-router)#version 2
R2(config-router)#no auto-summary
R2(config-router)#exit
R2(config)#router ospf 100
R2(config-router)#network 199.99.2.0 0.0.0.255 a 0
R2(config-router)#end
 
R2
R3(config)#int s1/0
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 loop0
R3(config-if)#ip add 172.16.1.1 255.255.255.0
R3(config-if)#exit       
R3(config)#int loop1
R3(config-if)#ip add 172.16.2.1 255.255.255.0
R3(config-if)#exit
R3(config)#int loop2
R3(config-if)#ip add 172.16.3.1 255.255.255.0
R3(config-if)#exit
R3(config)#router ospf 100
R3(config-router)#network 199.99.2.0 0.0.0.255 a 0
R3(config-router)#network 172.16.1.0 0.0.0.255 a 1
R3(config-router)#network 172.16.2.0 0.0.0.255 a 1
R3(config-router)#network 172.16.3.0 0.0.0.255 a 1
R3(config-router)#exit
好了,以上为基本的配置,下面我们在每台路由器上查看一下路由表:
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
 
C    199.99.1.0/24 is directly connected, Serial1/0
     192.168.1.0/27 is subnetted, 3 subnets
C       192.168.1.64 is directly connected, Loopback2
C       192.168.1.32 is directly connected, Loopback1
C       192.168.1.0 is directly connected, Loopback0
 
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
 
     172.16.0.0/32 is subnetted, 3 subnets
O IA    172.16.1.1 [110/65] via 199.99.2.2, 00:00:09, Serial1/1
O IA    172.16.3.1 [110/65] via 199.99.2.2, 00:00:09, Serial1/1
O IA    172.16.2.1 [110/65] via 199.99.2.2, 00:00:09, Serial1/1
C    199.99.2.0/24 is directly connected, Serial1/1
C    199.99.1.0/24 is directly connected, Serial1/0
     192.168.1.0/27 is subnetted, 3 subnets
R       192.168.1.64 [120/1] via 199.99.1.2, 00:00:05, Serial1/0
      192.168.1.32 [120/1] via 199.99.1.2, 00:00:05, Serial1/0
R       192.168.1.0 [120/1] via 199.99.1.2, 00:00:05, Serial1/0
 
R3#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
 
     172.16.0.0/24 is subnetted, 3 subnets
C       172.16.1.0 is directly connected, Loopback0
C       172.16.2.0 is directly connected, Loopback1
C       172.16.3.0 is directly connected, Loopback2
C    199.99.2.0/24 is directly connected, Serial1/0
可以看到R1上只显示了自己直连的路由,R2上显示了通过RIPOSPF学到的所有路由,R3上也只有自己直连的路由,下面在R2上配之路由重发布,在配置之前需要注意的是在把其他路由协议重发布到RIP,IGRP,EIGRP的时候,是需要手动添加度量,否则度量为无穷,但是重发布直连和静态路由时,度量默认为1 在把其他路由协议重发布到OSPF时,可以不用手动添加度量值,默认OSPF为重发布的路由分配的度量值为20
R2(config)#router rip
R2(config-router)#redistribute ospf 100 metric 3
这样配置完成后就把OSPF 100的路由重发布到RIP路由协议中,并且定义度量值为3跳,然后在R1上查看路由表:
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
 
     172.16.0.0/32 is subnetted, 3 subnets
R       172.16.1.1 [120/3] via 199.99.1.1, 00:00:05, Serial1/0
R       172.16.3.1 [120/3] via 199.99.1.1, 00:00:05, Serial1/0
R       172.16.2.1 [120/3] via 199.99.1.1, 00:00:05, Serial1/0
R    199.99.2.0/24 [120/3] via 199.99.1.1, 00:00:05, Serial1/0
C    199.99.1.0/24 is directly connected, Serial1/0
     192.168.1.0/27 is subnetted, 3 subnets
C       192.168.1.64 is directly connected, Loopback2
C       192.168.1.32 is directly connected, Loopback1
C       192.168.1.0 is directly connected, Loopback0
OK,学到了到R3上的路由,然后我们在R2上配置,把RIP重发布到OSPF中:
R2(config)#router ospf 100
R2(config-router)#redistribute rip subnets
在重发布到OSPF中时,需要带subnets参数,然后我们在R3上查看路由表:
R3#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
 
     172.16.0.0/24 is subnetted, 3 subnets
C       172.16.1.0 is directly connected, Loopback0
C       172.16.2.0 is directly connected, Loopback1
C       172.16.3.0 is directly connected, Loopback2
C    199.99.2.0/24 is directly connected, Serial1/0
O E2 199.99.1.0/24 [110/20] via 199.99.2.1, 00:00:09, Serial1/0
     192.168.1.0/27 is subnetted, 3 subnets
O E2    192.168.1.64 [110/20] via 199.99.2.1, 00:00:04, Serial1/0
O E2    192.168.1.32 [110/20] via 199.99.2.1, 00:00:03, Serial1/0
O E2    192.168.1.0 [110/20] via 199.99.2.1, 00:00:03, Serial1/0
好的,可以看到有O E2的路由了,表示OSPF自治系统外部路由,是从RIP重发布过来的。是类型2的外部路由,我们可以手动修改:
R2(config-router)#redistribute rip metric 40 metric-type 1 subnets
然后再到R3上查看路由表:
R3#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
 
     172.16.0.0/24 is subnetted, 3 subnets
C       172.16.1.0 is directly connected, Loopback0
C       172.16.2.0 is directly connected, Loopback1
C       172.16.3.0 is directly connected, Loopback2
C    199.99.2.0/24 is directly connected, Serial1/0
O E1 199.99.1.0/24 [110/104] via 199.99.2.1, 00:00:00, Serial1/0
     192.168.1.0/27 is subnetted, 3 subnets
O E1    192.168.1.64 [110/104] via 199.99.2.1, 00:00:00, Serial1/0
O E1    192.168.1.32 [110/104] via 199.99.2.1, 00:00:00, Serial1/0
O E1    192.168.1.0 [110/104] via 199.99.2.1, 00:00:00, Serial1/0
类型变成1类外部路由,度量值也变大了。
下面我们开始路由汇总的配置,首先在R1上汇总RIP路由:
R1(config)#int s1/0
R1(config-if)#ip summary-address rip 192.168.1.0 255.255.255.0
然后在R2R3上验证:
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
 
     172.16.0.0/32 is subnetted, 3 subnets
O IA    172.16.1.1 [110/65] via 199.99.2.2, 00:00:09, Serial1/1
O IA    172.16.3.1 [110/65] via 199.99.2.2, 00:00:09, Serial1/1
O IA    172.16.2.1 [110/65] via 199.99.2.2, 00:00:09, Serial1/1
C    199.99.2.0/24 is directly connected, Serial1/1
C    199.99.1.0/24 is directly connected, Serial1/0
R    192.168.1.0/24 [120/1] via 199.99.1.2, 00:00:09, Serial1/0
 
R3#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
 
     172.16.0.0/24 is subnetted, 3 subnets
C       172.16.1.0 is directly connected, Loopback0
C       172.16.2.0 is directly connected, Loopback1
C       172.16.3.0 is directly connected, Loopback2
C    199.99.2.0/24 is directly connected, Serial1/0
O E1 199.99.1.0/24 [110/104] via 199.99.2.1, 00:00:48, Serial1/0
O E1 192.168.1.0/24 [110/104] via 199.99.2.1, 00:00:33, Serial1/0
现在从RIP学到的路由变成了一条汇总的路由,注意在汇总路由时应注意,子网掩码应该大于或者等于默认主网络掩码。然后我们在R3上做汇总:
R3(config)#router ospf 100
R3(config-router)#area 1 rang 172.16.0.0 255.255.0.0
然后我们在R1R2上验证:
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
 
O IA 172.16.0.0/16 [110/65] via 199.99.2.2, 00:00:22, Serial1/1
C    199.99.2.0/24 is directly connected, Serial1/1
C    199.99.1.0/24 is directly connected, Serial1/0
R    192.168.1.0/24 [120/1] via 199.99.1.2, 00:00:04, Serial1/0
 
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
 
R    172.16.0.0/16 [120/3] via 199.99.1.1, 00:00:07, Serial1/0
R    199.99.2.0/24 [120/3] via 199.99.1.1, 00:00:07, Serial1/0
C    199.99.1.0/24 is directly connected, Serial1/0
     192.168.1.0/27 is subnetted, 3 subnets
C       192.168.1.64 is directly connected, Loopback2
C       192.168.1.32 is directly connected, Loopback1
C       192.168.1.0 is directly connected, Loopback0
现在从OSPF重发布的路由也变成了一条缺省路由。

实验总结:掌握RIPOSPF路由协议的重发布的方法和配置,并且掌握RIPOSPF汇总路由的配置




















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