简介
本文档介绍开放最短路径优先(OSPF)链路状态通告(LSA)第5类外部路由选择机制。它提供了网络场景,其中配置了如何选择从一个自治系统边界路由器(ASBR)接收的路由而不是从另一个自治系统边界路由器(ASBR)接收的路由。
先决条件
要求
思科建议您了解OSPF和IP路由。
使用的组件
本文档不限于特定的软件和硬件版本。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您使用的是真实网络,请确保您已经了解所有命令的潜在影响。
背景信息
如果将路由从其他路由协议或静态重分布到OSPF中,则会导致这些路由成为OSPF外部路由。外部路由分为两类:外部类型1(O E1)和外部类型2(O E2)。
两者之间的差异在于路由的开销(度量)的计算方式。类型 2 路由的成本始终为外部成本,与到达该路由的内部成本无关。类型 1 成本是用于到达该路由的外部成本和内部成本之和。对于同一目标,类型 1 路由始终优先于类型 2 路由。
配置
网络图
请考虑此网络拓扑,以检查从区域1中的ASBR在区域0中在R4上收到的LSA第5类。R2和R3是区域边界路由器(ABR)。
配置
为简单起见,此配置在区域1路由器R5和R1的ASBR上重分布静态路由。
R5# ip route 192.168.1.1 255.255.255.255 Null0 router ospf 1 redistribute static subnets network 10.5.5.5 0.0.0.0 area 1 network 10.10.25.5 0.0.0.0 area 1 |
R1# ip route 192.168.1.1 255.255.255.255 Null0
router ospf 1 redistribute static subnets network 10.1.1.1 0.0.0.0 area 1 network 10.10.13.1 0.0.0.0 area 1 |
注:如果未指定度量,则OSPF会在从除边界网关协议(BGP)路由外的所有协议重分发路由时将默认值设置为20。当有主网被划分子网时,必须使用关键字subnet将协议重分发到OSPF。如果不使用这个关键字,OSPF 将只再分配没有划分子网的主网。
验证
您可以使用以下命令来验证重分发:
R5#show ip ospf
Routing Process "ospf 1" with ID 10.5.5.5
Start time: 00:06:18.188, Time elapsed: 00:26:04.176
Supports only single TOS(TOS0) routes
Supports opaque LSA
Supports Link-local Signaling (LLS)
Supports area transit capability
Supports NSSA (compatible with RFC 3101)
Event-log enabled, Maximum number of events: 1000, Mode: cyclic
It is an autonomous system boundary router
Redistributing External Routes from,
static, includes subnets in redistribution
Router is not originating router-LSAs with maximum metric
Initial SPF schedule delay 5000 msecs
Minimum hold time between two consecutive SPFs 10000 msecs
Maximum wait time between two consecutive SPFs 10000 msecs
Incremental-SPF disabled
Minimum LSA interval 5 secs
Minimum LSA arrival 1000 msecs
LSA group pacing timer 240 secs
Interface flood pacing timer 33 msecs
Retransmission pacing timer 66 msecs
Number of external LSA 2. Checksum Sum 0x010F34
Number of opaque AS LSA 0. Checksum Sum 0x000000
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Number of areas transit capable is 0
External flood list length 0
IETF NSF helper support enabled
Cisco NSF helper support enabled
Reference bandwidth unit is 100 mbps
Area 1
Number of interfaces in this area is 2 (1 loopback)
Area has no authentication
SPF algorithm last executed 00:22:45.848 ago
SPF algorithm executed 2 times
Area ranges are
Number of LSA 11. Checksum Sum 0x03C19D
Number of opaque link LSA 0. Checksum Sum 0x000000
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
R1#show ip ospf
Routing Process "ospf 1" with ID 10.1.1.1
Start time: 00:07:09.376, Time elapsed: 00:27:30.368
Supports only single TOS(TOS0) routes
Supports opaque LSA
Supports Link-local Signaling (LLS)
Supports area transit capability
Supports NSSA (compatible with RFC 3101)
Event-log enabled, Maximum number of events: 1000, Mode: cyclic
It is an autonomous system boundary router
Redistributing External Routes from,
static, includes subnets in redistribution
Router is not originating router-LSAs with maximum metric
Initial SPF schedule delay 5000 msecs
Minimum hold time between two consecutive SPFs 10000 msecs
Maximum wait time between two consecutive SPFs 10000 msecs
Incremental-SPF disabled
Minimum LSA interval 5 secs
Minimum LSA arrival 1000 msecs
LSA group pacing timer 240 secs
Interface flood pacing timer 33 msecs
Retransmission pacing timer 66 msecs
Number of external LSA 2. Checksum Sum 0x010F34
Number of opaque AS LSA 0. Checksum Sum 0x000000
Number of DCbitless external and opaque AS LSA 0
Number of DoNotAge external and opaque AS LSA 0
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Number of areas transit capable is 0
External flood list length 0
IETF NSF helper support enabled
Cisco NSF helper support enabled
Reference bandwidth unit is 100 mbps
Area 1
Number of interfaces in this area is 2 (1 loopback)
Area has no authentication
SPF algorithm last executed 00:24:42.268 ago
SPF algorithm executed 2 times
Area ranges are
Number of LSA 11. Checksum Sum 0x076A33
Number of opaque link LSA 0. Checksum Sum 0x000000
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
因此,R5和R1从ASBR路由器重新分发静态路由。要检查路由器R4上的重分发路由的前缀192.168.1.1/32,请输入以下命令:
R4#show ip route 192.168.1.1 255.255.255.255
Routing entry for 192.168.1.1/32
Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 2
Last update from 10.10.24.2 on FastEthernet0/0, 00:25:43 ago
Routing Descriptor Blocks:
* 10.10.34.3, from 10.1.1.1, 00:26:44 ago, via FastEthernet0/1
Route metric is 20, traffic share count is 1
10.10.24.2, from 10.5.5.5, 00:25:43 ago, via FastEthernet0/0
Route metric is 20, traffic share count is 1
这表示源自10.1.1.1(R1)和10.5.5.5(R5)的路由都安装在路由表中,度量为20。
这也可以在OSPF数据库中检查:
如前所述,当路由重分发到OSPF时,默认将度量值设置为20。接下来,在ASBR 10.1.1.1(R1)上重分布时定义值10,并检查Router 4上的输出。
以下是R1上实施的更改:
R1(config)#router ospf 1
R1(config-router)#redistribute static subnets metric 10
以下是R4的路由表:
R4#show ip route 192.168.1.1 255.255.255.255
Routing entry for 192.168.1.1/32
Known via "ospf 1", distance 110, metric 10, type extern 2, forward metric 2
Last update from 10.10.34.3 on FastEthernet0/1, 00:00:09 ago
Routing Descriptor Blocks:
* 10.10.34.3, from 10.1.1.1, 00:00:09 ago, via FastEthernet0/1
Route metric is 10, traffic share count is 1
路由表中只有一个条目。进一步检查此外部LSA的OSPF数据库。
转发度量
转发度量是从路由器到达ASBR的开销。可以使用以下命令检查此情况:
R4#show ip ospf border-routers
OSPF Router with ID (10.4.4.4) (Process ID 1)
Base Topology (MTID 0)
Internal Router Routing Table
Codes: i - Intra-area route, I - Inter-area route
i 10.3.3.3 [1] via 10.10.34.3, FastEthernet0/1, ABR, Area 0, SPF 3
I 10.1.1.1 [2] via 10.10.34.3, FastEthernet0/1, ASBR, Area 0, SPF 3
i 10.2.2.2 [1] via 10.10.24.2, FastEthernet0/0, ABR, Area 0, SPF 3
I 10.5.5.5 [2] via 10.10.24.2, FastEthernet0/0, ASBR, Area 0, SPF 3
在此输出中,从路由器R4到达ASBR(R1和R5)的开销为2。默认情况下,OSPF中快速以太网接口的开销为1。因此,在本例中,从R4到达R1或R5的开销为2:转发度量=到达ABR的路由器开销(1)+到达ASBR的ABR开销(1)= 2。
将R5上的重分发度量也更改为10,因此两个路由都重新安装在路由表中。
以下是R1上实施的更改:
R5(config)#router ospf 1
R5(config-router)#redistribute static subnets metric 10
以下是R4的路由表:
R4#show ip route 192.168.1.1 255.255.255.255
Routing entry for 192.168.1.1/32
Known via "ospf 1", distance 110, metric 10, type extern 2, forward metric 2
Last update from 10.10.24.2 on FastEthernet0/0, 00:00:12 ago
Routing Descriptor Blocks:
* 10.10.34.3, from 10.1.1.1, 00:12:05 ago, via FastEthernet0/1
Route metric is 10, traffic share count is 1
10.10.24.2, from 10.5.5.5, 00:00:12 ago, via FastEthernet0/0
Route metric is 10, traffic share count is 1
更改到达其中一个ASBR但具有相同重分发度量的开销并检查相同的输出。
增加路由器R4的fa0/1的OSPF开销:
R4(config)#int fa0/1
R4(config-if)#ip ospf cost 10
检查转发度量。它显示,现在到达ASBR R1的开销为11:
R4#show ip ospf border-routers
OSPF Router with ID (10.4.4.4) (Process ID 1)
Base Topology (MTID 0)
Internal Router Routing Table
Codes: i - Intra-area route, I - Inter-area route
i 10.3.3.3 [10] via 10.10.34.3, FastEthernet0/1, ABR, Area 0, SPF 7
I 10.1.1.1 [11] via 10.10.34.3, FastEthernet0/1, ASBR, Area 0, SPF 7
i 10.2.2.2 [1] via 10.10.24.2, FastEthernet0/0, ABR, Area 0, SPF 7
I 10.5.5.5 [2] via 10.10.24.2, FastEthernet0/0, ASBR, Area 0, SPF 7
以下是R4的路由表:
R4#show ip route 192.168.1.1 255.255.255.255
Routing entry for 192.168.1.1/32
Known via "ospf 1", distance 110, metric 10, type extern 2, forward metric 2
Last update from 10.10.24.2 on FastEthernet0/0, 00:02:17 ago
Routing Descriptor Blocks:
10.10.24.2, from 10.5.5.5, 00:07:11 ago, via FastEthernet0/0
Route metric is 10, traffic share count is 1
因此,具有较低转发度量的路由会安装到路由表中。
总之,当您有多个第5类LSA条目时,第一个首选项将指定给度量(重分发度量)。 具有较低度量的路由会安装到路由表中。如果重分发的度量相同,则向转发度量提供第二个优先级。具有较低转发度量的路由会安装到路由表中。
故障排除
目前没有针对此配置的故障排除信息。