十五、CCNP-路由重发布

15.1 概念

  • 一个网络中存在两种不同路由协议,如RIP和OSPF;
  • 一个网络中存在两种不同路由进程,如OSPF,同一台路由器两个接口运行两个不同OSPF进程,这是两个进程路由相互独立;
  • 如R2路由器两个接口分别运行RIP和OSPF协议,两端完全独立,互不知道;
  • 将一种动态路由选择协议信息注入到另一种动态路由选择协议中,从而达到同步全网的信息。

路有重发布是有方向的。

15.2 路由回馈

  • 动态路由选择域范围是针对接口的;
  • 如将直连网段192.168.1.0注入到RIP中,所有激活RIP的接口上接收。

对于R3和R4,都会学习到RIP的1921.68.1.0的路由,这时在R3上做路由重发布,注入OSPF。

R3将RIP路由注入OSPF,R3想R1更新,即5类LSA,R1同步LSDB,同步给R2,R2同步给R4。但是R3路由器本身就有RIP的该网段路由,同时R3又通过OSPF从R2获取到了该网点的路由。即两种不同的路由协议学习到了去往同一个网络的路由。

R4去往192.168.1.0时,如果比较AD小,则OSPF会更好,这时R4去192.168.1.0会从R2->R1->R3的方向走,绕远路走。

15.3 度量值

15.4 试验

路由器R1配置,配置接口地址和LOOPBACK地址

R1#conf t
R1(config-if)#ip address 192.168.12.1 255.255.255.0
R1(config-if)#no shutdown

R1(config)#interface loopback 0
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R1(config-if)#no shutdown

将接口和LOOPBACK发布到RIP

R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#network 192.168.12.0
R1(config-router)#network 1.1.1.1

路由器R1配置,配置接口地址和LOOPBACK地址

R2#conf t
R2(config)#interface serial 0/0
R2(config-if)#ip address 192.168.12.2 255.255.255.0
R2(config-if)#no shutdown

R2(config)#interface serial 0/1
R2(config-if)#ip address 192.168.23.2 255.255.255.0
R2(config-if)#no shutdown

R2(config)#interface loopback 0
R2(config-if)#ip address 2.2.2.2 255.255.255.0
R2(config-if)#no shutdown

将接口发布到RIP和OSPF

R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#network 192.168.12.0

R2(config)#router ospf 1
R2(config-router)#network 192.168.23.2 0.0.0.0 area 0

路由器R1配置,配置接口地址和LOOPBACK地址

R3#conf t
R3(config)#interface serial 0/1
R3(config-if)#ip address 192.168.23.3 255.255.255.0
R3(config-if)#no shutdown

R3(config)#interface loopback 0
R3(config-if)#ip address 3.3.3.3 255.255.255.0
R3(config-if)#no shutdown

将接口和LOOPBACK发布到OSPF

R3(config)#router ospf 1
R3(config-router)#network 192.168.23.3 0.0.0.0 area 0
R3(config-router)#network 3.3.3.3 0.0.0.0 area 0

R3(config)#interface loopback 0
R3(config-if)#ip ospf network point-to-point

R2能正常学习到RIP和OSPF路由了

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

C    192.168.12.0/24 is directly connected, Serial1/0
R    1.0.0.0/8 [120/1] via 192.168.12.1, 00:00:09, Serial1/0
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback0
     3.0.0.0/24 is subnetted, 1 subnets
O       3.3.3.0 [110/65] via 192.168.23.3, 00:00:19, Serial1/1
C    192.168.23.0/24 is directly connected, Serial1/1

但是R3并没有学习到任何路由,因为没有重分发,就不会把左右边告诉OSPF进程

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

     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Loopback0
C    192.168.23.0/24 is directly connected, Serial1/1

R1同样也没有OSPF的路由

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    192.168.12.0/24 is directly connected, Serial1/0
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0

这时就需要借助重发布了

15.4.1 重发布RIP路由

首先将RIP注入注入到OSPF中,进入OSPF进程,将RIP重发布,这时可以不设置METRIC值,则默认为20

R2(config)#router ospf 1
R2(config-router)#redistribute rip subnets

路由器多了两条OE2路由,即外部路由

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

O E2 192.168.12.0/24 [110/20] via 192.168.23.2, 00:00:24, Serial1/1
O E2 1.0.0.0/8 [110/20] via 192.168.23.2, 00:00:24, Serial1/1
     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Loopback0
C    192.168.23.0/24 is directly connected, Serial1/1

由于重发布时单向的,这时对于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

C    192.168.12.0/24 is directly connected, Serial1/0
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0

15.4.2 重发布OSPF路由

继续在R2上,将OSPF路由注入到RIP中。

R2#conf t
R2(config)#router rip
R2(config-router)#redistribute ospf 1

R1依旧没有,因为向RIP中注入是,如果不设定METRIC值,则视为无穷大,这时充分发失败。

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    192.168.12.0/24 is directly connected, Serial1/0
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0

重分发时,加上METRIC值

R2(config)#router rip
R2(config-router)#redistribute ospf 1 metric 2

R1就学到了OSPF路由了

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    192.168.12.0/24 is directly connected, Serial0/0
     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
R    3.0.0.0/8 [120/2] via 192.168.12.2, 00:00:05, Serial0/0
R    192.168.23.0/24 [120/2] via 192.168.12.2, 00:00:05, Serial0/0

在R2上配置静态路由,由于METRIC小,会覆盖

R2(config)#ip route 1.0.0.0 255.0.0.0 null 0

R2的路由表中1.0..0.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

C    192.168.12.0/24 is directly connected, Serial0/0
S    1.0.0.0/8 is directly connected, Null0
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback0
     3.0.0.0/24 is subnetted, 1 subnets
O       3.3.3.0 [110/65] via 192.168.23.3, 00:10:49, Serial0/1
C    192.168.23.0/24 is directly connected, Serial0/1

这时R3中没有了1.0.0.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

O E2 192.168.12.0/24 [110/20] via 192.168.23.2, 00:11:20, Serial0/1
     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Loopback0
C    192.168.23.0/24 is directly connected, Serial0/1

去除测试路由

R2(config)#no ip route 1.0.0.0 255.0.0.0 null 0

15.4.3 重发布直连接口

将R3的LOOPBACK地址从OSPF中去除,已重发布的方式注入

R3(config)#router ospf 1
R3(config-router)#no network 3.3.3.3 0.0.0.0 area 0

这时R2中就没有3.3.3.3的路由了

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

C    192.168.12.0/24 is directly connected, Serial0/0
S    1.0.0.0/8 is directly connected, Null0
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback0
C    192.168.23.0/24 is directly connected, Serial0/1

在R3上重分发本地所有直连接口,要求物理和协议上都是UP状态。

R3(config)#router ospf 1
R3(config-router)#redistribute connected subnets metric 10 metric-type 1

这时R2上就有了3.3.3.3的路由

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

C    192.168.12.0/24 is directly connected, Serial0/0
S    1.0.0.0/8 is directly connected, Null0
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback0
     3.0.0.0/24 is subnetted, 1 subnets
O E1    3.3.3.0 [110/74] via 192.168.23.3, 00:00:07, Serial0/1
C    192.168.23.0/24 is directly connected, Serial0/1

15.4.4 重分发静态路由

在R1上去除RIP

R1(config)#no router rip

在R2上去除RIP

R2(config)#no router rip

这时R3中就不会有去往1.1.1.1的路由了

R2上配置静态路由

R2(config)#ip route 1.1.1.0 255.255.255.0 192.168.12.1

重发布静态路由

R2(config)#router ospf 1
R2(config-router)#redistribute static subnets

R3就有1.1.1.1的路由了

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

     1.0.0.0/24 is subnetted, 1 subnets
O E2    1.1.1.0 [110/20] via 192.168.23.2, 00:00:13, Serial0/1
     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Loopback0
C    192.168.23.0/24 is directly connected, Serial0/1

15.5 重分发模型

15.5.1 单点单向重分发

引发次优路由的问题

15.5.2 单点双向重发布

如试验的R2路由器,两边重发布

15.5.3 多点重发布

边界同时做重发布,R3和R4都做重发布。

R3上重发布后,如果在R4重发布,容易引发失败,因为R3重发布后,R4已经有了,R4再重发布,相当于重发布已经存在的,所以失败。

15.5.4 多点双向重发布

R2和R3朝两个方向都重发布;

15.6 配置

需要先进入路由选择进程。然后选择该进程下需要做重发布的路由。

15.6.1 重分发RIP

.

如需要重发布到RIP,进入RIP进程,然后选择需要将重分发的协议。

需要设置METRIC,否则会失败。

需要配置METRIC,默认默认无穷大。

15.6.2 重分发OSPF

这个可以不需要METRIC,用默认值,但是需要加subnets,否则只能发布主类路由。

15.6.3 重分发EIGRP

需要完整的指定5个元素

发表回复