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

CCNP-21 路由重发布1

实验拓扑:

试验要求: R1 R2 运行 RIP R3 R2 之间运行 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
R       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 上显示了通过 RIP OSPF 学到的所有路由, 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
然后在 R2 R3 上验证:
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
然后我们在 R1 R2 上验证:
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 重发布的路由也变成了一条缺省路由。

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

你可能感兴趣的:(职场,路由,休闲,重发布,CCNP-21)