OSPF:LSA Type-5 转发地址对选路影响(实验)

 

1.转发地址影响选路(1

1.1实验拓扑

OSPF:LSA Type-5 转发地址对选路影响(实验)_第1张图片

1.2实验需求

(1)按拓扑完成基本配置

(2)R2、R3上写一条相同的静态路由,ip route 10.10.10.0 255.255.255.0 31.31.23.100

(3)重分发静态路由进入OSPF进程,观察LSA Type 5以及R1的选路情况

(4)R2将与R3之间网络宣告进OSPF,R3不作改变,观察LSA Type 5以及R1的选路情况

1.3实验步骤

1静态路由

R2(config)#ip route 10.10.10.0 255.255.255.0 31.31.23.100

R2(config)#router ospf 1

R2(config-router)#redistribute static subnets

R3做相同配置
 

R2#show ip ospf database external | include Forward

        Forward Address: 0.0.0.0

        Forward Address: 0.0.0.0

R2Forward Address有两个输出,这是因为该网络中有两台ASBR携带外部路由,此时转发地址为0.0.0.0

 

2R1选路

R1#show ip ospf border-routers

OSPF Process 1 internal Routing Table

Codes: i - Intra-area route, I - Inter-area route

i 2.2.2.2 [1] via 31.31.12.2, FastEthernet0/0, ASBR, Area 0, SPF 6

i 3.3.3.3 [2] via 31.31.14.4, FastEthernet1/0, ASBR, Area 0, SPF 6

由于通告外部路由的是ASBR,且此时转发地址为0.0.0.0,外部路由类型为Type-2

由上输出可见,R1去往ASBR R2的开销更小

 

R1#show ip route ospf

     10.0.0.0/24 is subnetted, 1 subnets

O E2    10.10.10.0 [110/20] via 31.31.12.2, 00:03:29, FastEthernet0/0

     31.0.0.0/24 is subnetted, 3 subnets

O       31.31.34.0 [110/2] via 31.31.14.4, 00:03:29, FastEthernet1/0

可见此时R1选择R2去往外部网络

 

3R2R3直连网络参与R2 OSPF进程

R2(config)#router ospf 1

R2(config-router)#network 31.31.23.2 0.0.0.0 a 0

 

R2#show ip ospf database external

 

            OSPF Router with ID (2.2.2.2) (Process ID 1)

 

                Type-5 AS External Link States

 

  LS age: 15

  Options: (No TOS-capability, DC)

  LS Type: AS External Link

  Link State ID: 10.10.10.0 (External Network Number )

  Advertising Router: 2.2.2.2

  LS Seq Number: 80000002

  Checksum: 0xB50A

  Length: 36

  Network Mask: /24

        Metric Type: 2 (Larger than any link state path)

        TOS: 0

        Metric: 20

        Forward Address: 31.31.23.100

        External Route Tag: 0

 

  Routing Bit Set on this LSA

  LS age: 359

  Options: (No TOS-capability, DC)

  LS Type: AS External Link

  Link State ID: 10.10.10.0 (External Network Number )

  Advertising Router: 3.3.3.3

  LS Seq Number: 80000001

  Checksum: 0x2452

  Length: 36

  Network Mask: /24

        Metric Type: 2 (Larger than any link state path)

        TOS: 0

        Metric: 20

        Forward Address: 0.0.0.0

        External Route Tag: 0

根据转发地址判定规则,此时由R2通告的路由,其转发地址为静态路由中的下一跳

 

4R1选路

R1#show ip ospf border-routers

OSPF Process 1 internal Routing Table

Codes: i - Intra-area route, I - Inter-area route

i 2.2.2.2 [1] via 31.31.12.2, FastEthernet0/0, ASBR, Area 0, SPF 7

i 3.3.3.3 [2] via 31.31.14.4, FastEthernet1/0, ASBR, Area 0, SPF 7

此时去往ASBR的开销并没有发生变化

 

R1#show ip route ospf

     10.0.0.0/24 is subnetted, 1 subnets

O E2    10.10.10.0 [110/20] via 31.31.14.4, 00:04:47, FastEthernet1/0

     31.0.0.0/24 is subnetted, 4 subnets

O       31.31.23.0 [110/11] via 31.31.12.2, 00:04:47, FastEthernet0/0

O       31.31.34.0 [110/2] via 31.31.14.4, 00:04:47, FastEthernet1/0

此时R1去往外部网络选择R4作为下一跳

1.4实验结论

当出现转发地址时,当前路由器将以去往转发地址的开销作为参考依据而不再是去往ASBR的开销

 

 

2.转发地址影响选路(2

2.1实验拓扑

OSPF:LSA Type-5 转发地址对选路影响(实验)_第2张图片

2.2实验需求

1)按拓扑完成基本配置

2R2上写去往5.5.5.0的静态路由指向R5R5上写缺省路由指向R2以保证连通性

3R1上写一条去往5.5.5.0的静态路由,只指定出口,重分发该路由进入OSPF进程,观察实验现象

4)静态路由增加下一跳为R2,观察实验现象

5R4上写一条静态路由,ip route 31.31.123.0 255.255.255.0 null 0,观察实验现象

2.3实验步骤

1完成需求(2

R2(config)#ip route 5.5.5.0 255.255.255.0 31.31.25.5

 

R5(config)#ip route 0.0.0.0 0.0.0.0 31.31.25.2

 

2完成需求(3

R1(config)#ip route 5.5.5.0 255.255.255.0 f0/0

R1(config)#router ospf 1

R1(config-router)#redistribute static subnets

 

R1#show ip ospf database external | include Forward

        Forward Address: 0.0.0.0

 

R4#traceroute 5.5.5.5

 

Type escape sequence to abort.

Tracing the route to 5.5.5.5

 

  1 31.31.34.3 60 msec 32 msec 44 msec

  2 31.31.123.1 80 msec 60 msec 88 msec

  3 31.31.123.2 68 msec 68 msec 120 msec

  4 31.31.25.5 124 msec *  76 msec

此时数据包走了一条次优路径

 

R3#show ip route ospf

     5.0.0.0/24 is subnetted, 1 subnets

O E2    5.5.5.0 [110/20] via 31.31.123.1, 00:01:53, FastEthernet0/0

R3上目标网络下一跳为R1

 

3完成需求(4

R1(config)#no ip route 5.5.5.0 255.255.255.0

R1(config)#ip route 5.5.5.0 255.255.255.0 31.31.123.

 

R1#show ip ospf database external | in Forward

        Forward Address: 31.31.123.2

此时产生了转发地址

 

R3#show ip route ospf

     5.0.0.0/24 is subnetted, 1 subnets

O E2    5.5.5.0 [110/20] via 31.31.123.2, 00:00:57, FastEthernet0/0

此时R3将转发地址作为下一跳

 

4完成需求(5

R4(config)#ip route 31.31.123.0 255.255.255.0 null0

 

R4#show ip ospf database external | in Forward

        Forward Address: 31.31.123.2

R4#show ip route static

     31.0.0.0/24 is subnetted, 2 subnets

S       31.31.123.0 is directly connected, Null0

R4上,此时转发地址不可达

 

R4#show ip route ospf

输出为空

 

R4#show ip ospf database external

 

            OSPF Router with ID (4.4.4.4) (Process ID 1)

 

                Type-5 AS External Link States

 

  LS age: 308

  Options: (No TOS-capability, DC)

  LS Type: AS External Link

  Link State ID: 5.5.5.0 (External Network Number )

  Advertising Router: 1.1.1.1

  LS Seq Number: 80000001

  Checksum: 0x428F

  Length: 36

  Network Mask: /24

        Metric Type: 2 (Larger than any link state path)

        TOS: 0

        Metric: 20

        Forward Address: 31.31.123.2

        External Route Tag: 0

R3#show ip ospf database external

 

            OSPF Router with ID (3.3.3.3) (Process ID 1)

 

                Type-5 AS External Link States

 

  Routing Bit Set on this LSA

  LS age: 317

  Options: (No TOS-capability, DC)

  LS Type: AS External Link

  Link State ID: 5.5.5.0 (External Network Number )

  Advertising Router: 1.1.1.1

  LS Seq Number: 80000001

  Checksum: 0x428F

  Length: 36

  Network Mask: /24

        Metric Type: 2 (Larger than any link state path)

        TOS: 0

        Metric: 20

        Forward Address: 31.31.123.2

        External Route Tag: 0

此时R4上,该LSA失效,Routing Bit Set on this LSA消息

2.4实验结论

1)转发地址可以避免次优路径问题

2)当转发地址在本地失效时,对应外部网络也将无效

 

 

3.下游设备

3.1实验拓扑

OSPF:LSA Type-5 转发地址对选路影响(实验)_第3张图片

3.2实验需求

1)按拓扑完成基本配置

2R1上将RIP路由重分发进OSPF,并将连接RIP域的接口网络宣告进OSPF进程

3R2上观察LSA Type 5中的转发地址以及路由学习情况

4)要求此时R2走最优路径,抵达R3的环回口网络

3.3实验步骤

1完成需求(2

R1(config)#router ospf 1

R1(config-router)#redistribute rip subnets

R1(config-router)#network 31.31.123.1 0.0.0.0 a 0

 

2实验现象

R2#show ip ospf database external

 

            OSPF Router with ID (2.2.2.2) (Process ID 1)

 

                Type-5 AS External Link States

 

  LS age: 31

  Options: (No TOS-capability, DC)

  LS Type: AS External Link

  Link State ID: 3.3.3.0 (External Network Number )

  Advertising Router: 1.1.1.1

  LS Seq Number: 80000001

  Checksum: 0x983E

  Length: 36

  Network Mask: /24

        Metric Type: 2 (Larger than any link state path)

        TOS: 0

        Metric: 20

        Forward Address: 31.31.123.3

        External Route Tag: 0

此时出现转发地址,为31.31.123.3,但是路由比特位未出现,表明该LSA无效

 

R1#show ip route ospf

O    192.168.24.0/24 [110/2] via 192.168.14.4, 00:00:04, FastEthernet0/0

不学习远程网络

 

3去除转发地址

R1(config-router)#no network 31.31.123.1 0.0.0.0 a 0

 

R2#show ip ospf database external

 

            OSPF Router with ID (2.2.2.2) (Process ID 1)

 

                Type-5 AS External Link States

 

  Routing Bit Set on this LSA

  LS age: 20

  Options: (No TOS-capability, DC)

  LS Type: AS External Link

  Link State ID: 3.3.3.0 (External Network Number )

  Advertising Router: 1.1.1.1

  LS Seq Number: 80000002

  Checksum: 0x5B37

  Length: 36

  Network Mask: /24

        Metric Type: 2 (Larger than any link state path)

        TOS: 0

        Metric: 20

        Forward Address: 0.0.0.0

        External Route Tag: 0

 

  Routing Bit Set on this LSA

  LS age: 25

  Options: (No TOS-capability, DC)

  LS Type: AS External Link

  Link State ID: 31.31.123.0 (External Network Number )

  Advertising Router: 1.1.1.1

  LS Seq Number: 80000001

  Checksum: 0x7171

  Length: 36

  Network Mask: /24

        Metric Type: 2 (Larger than any link state path)

        TOS: 0

        Metric: 20

        Forward Address: 0.0.0.0

        External Route Tag: 0

此时转发地址消失,且还通告了R1R2R3间的直连网络

 

R2#show ip route ospf

O    192.168.14.0/24 [110/2] via 192.168.24.4, 00:01:02, FastEthernet0/0

     3.0.0.0/24 is subnetted, 1 subnets

O E2    3.3.3.0 [110/20] via 192.168.24.4, 00:01:02, FastEthernet0/0

出现远端网络(此时从宏观上来看是一个次优路径)

 

4解决出现的问题

R1(config-router)#network 31.31.123.1 0.0.0.0 a 0              //产生转发地址

 

R2(config-router)#network 31.31.123.2 0.0.0.0 a 0            //让转发地址所属网络加入到OSPF进程中

R2(config-router)#passive-interface f1/0               //防止R1R2RIP域中建立OSPF邻接关系

 

R2#show ip route ospf

O    192.168.14.0/24 [110/2] via 192.168.24.4, 00:10:48, FastEthernet0/0

     3.0.0.0/24 is subnetted, 1 subnets

O E2    3.3.3.0 [110/20] via 31.31.123.3, 00:00:32, FastEthernet1/0

注意:

这里如果配置R1的接口fa1/0为被动接口,则产生的LSA Type 5Forward Address将为0.0.0.0

3.4实验结论

当转发地址非0.0.0.0时,判断转发地址所属子网是否存在于本地OSPF进程中,如果不存在,则判定该LSA无效

如果是转发地址所属子网是下游设备的直连网络,只要参与OSPF进程,即便被配置为Passive,也判定有效

本文出自 “Thely” 博客,请务必保留此出处http://thely.blog.51cto.com/2695427/1014735

你可能感兴趣的:(实验,ospf,转发地址)