[Lab2-1]OSPF区域间选路

OSPF专题的补充,我们来了解下 OSPF区域间的选路

[Lab2-1]OSPF区域间选路_OSPF区域间选路

每个router的cost值配置如下

R1:

S0/0: IP ospf cost 1

R2:

S0/0: IP OSPF Cost 1

S0/1: IP ospf cost 10

S0/2: IP OSPF Cost 2

R3:

S0/0: IP ospf cost 10

S0/1: IP ospf cost 2

S0/2: IP ospf cost 2

R4:

S0/0: IP ospf cost 2

S0/1: IP ospf cost 2

S0/2: IP ospf cost 5

R5:

S0/2: IP ospf cost 2

S0/3: IP ospf cost 5

我们来看下R5 是怎么走到R1 12.1.1.0这个网段的?

先看下R5的路由表

R5#sh ip route

34.0.0.0/24 is subnetted, 1 subnets

O 34.1.1.0 [110/4] via 35.1.1.3, 00:13:12, Serial0/2

35.0.0.0/24 is subnetted, 1 subnets

C 35.1.1.0 is directly connected, Serial0/2

23.0.0.0/24 is subnetted, 1 subnets

O IA 23.1.1.0 [110/12] via 35.1.1.3, 00:13:12, Serial0/2

24.0.0.0/24 is subnetted, 1 subnets

O IA 24.1.1.0 [110/6] via 35.1.1.3, 00:13:12, Serial0/2

12.0.0.0/24 is subnetted, 1 subnets

O IA 12.1.1.0 [110/7] via 35.1.1.3, 00:13:12, Serial0/2

45.0.0.0/24 is subnetted, 1 subnets

C 45.1.1.0 is directly connected, Serial0/3

R5 -----> R1 的 Cost值为7

走向: R5—R3—R4—R2—R1 (如图)

[Lab2-1]OSPF区域间选路_OSPF区域间选路_02

但实际情况是:

[Lab2-1]OSPF区域间选路_OSPF区域间选路_03

[Lab2-1]OSPF区域间选路_OSPF区域间选路_04

证明了一点:我们察看的路由跟实际转发不一样!

原因如下:

[Lab2-1]OSPF区域间选路_OSPF区域间选路_05

总结如下:

OSPF区域间的路由,并不是完全根据cost 值计算的最短路径优先算法,而是有点类似于距离矢量的算法