简介
本文档介绍开放最短路径优先第3版(OSPFv3)自治系统(AS)外部链路状态通告(LSA)第5类路由选择机制。它提供了网络场景,其中配置了如何选择从一个自治系统边界路由器(ASBR)接收的路由而不是从另一个自治系统边界路由器(ASBR)接收的路由。
先决条件
要求
思科建议您了解OSPFv3和IPv6路由。
使用的组件
本文档不限于特定的软件和硬件版本。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您使用的是真实网络,请确保您已经了解所有命令的潜在影响。
背景信息
如果路由从其他IPv6路由协议或从IPv6静态路由重分发到OSPFv3,则默认情况下,这些路由将成为OSPF AS外部路由。这些AS — 外部路由分为两类:外部类型1(O E1)和外部类型2(O E2)。
两者之间的差异在于路由的开销(度量)的计算方式。第2类路由的开销始终是外部开销。对于同一目标,类型 1 路由始终优先于类型 2 路由。
配置
网络图
请考虑以下网络拓扑,以检查从区域1中的ASBR发起的区域0中的R4上收到的AS — 外部LSA 5。R2和R3是区域边界路由器(ABR)。
配置
为简单起见,此配置在区域1路由器R5和R1的ASBR上重分发IPv6静态路由。
R5#
ipv6 route FD00:AAAA:BBBB:CCCC::/64 Null0
!
interface FastEthernet0/0
ipv6 address FD00:AAAA:BBBB:25::5/64
ipv6 ospf 10 area 1
!
ipv6 router ospf 10
router-id 192.168.1.5
redistribute static
R1#
ipv6 route FD00:AAAA:BBBB:CCCC::/64 Null0
!
interface FastEthernet0/1
ipv6 address FD00:AAAA:BBBB:13::1/64
ipv6 ospf 10 area 1
!
ipv6 router ospf 10
router-id 192.168.1.1
redistribute static
注意:如果未指定度量,则当OSPFv3从除边界网关协议(BGP)路由(接收度量1)外的所有协议重分发路由时,它会将默认值设置为20。
验证
您可以使用以下命令来验证重分发:
R5#show ipv6 ospf
Routing Process "ospfv3 10" with ID 192.168.1.5
Event-log enabled, Maximum number of events: 1000, Mode: cyclic
It is an autonomous system boundary router
Redistributing External Routes from,
static
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
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 0x0100D4
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Graceful restart helper support enabled
Reference bandwidth unit is 100 mbps
RFC1583 compatibility enabled
Area 1
Number of interfaces in this area is 1
SPF algorithm executed 5 times
Number of LSA 16. Checksum Sum 0x08011B
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
R1#show ipv6 ospf
Routing Process "ospfv3 10" with ID 192.168.1.1
Event-log enabled, Maximum number of events: 1000, Mode: cyclic
It is an autonomous system boundary router
Redistributing External Routes from,
static
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
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 0x0100D4
Number of areas in this router is 1. 1 normal 0 stub 0 nssa
Graceful restart helper support enabled
Reference bandwidth unit is 100 mbps
RFC1583 compatibility enabled
Area 1
Number of interfaces in this area is 1
SPF algorithm executed 6 times
Number of LSA 16. Checksum Sum 0x08AD19
Number of DCbitless LSA 0
Number of indication LSA 0
Number of DoNotAge LSA 0
Flood list length 0
因此,ASBR路由器R5和R1都会重分发IPv6静态路由。要检查路由器R4的路由表和OSPFv3数据库中的重分发路由的前缀FD00:AAA:BBBB:CCCC::/64,请输入以下命令:
重分发度量
如前所述,当路由重分发到OSPFv3时,默认将度量值设置为20。接下来,在ASBR 192.168.1.1(R1)上重分发时,定义值10,并检查路由器4上的输出。
以下是R1上实施的更改:
R1(config)#ipv6 router ospf 10
R1(config-rtr)#redistribute static metric 10
路由表现在只显示IPv6路由表中的一个条目。进一步检查OSPF数据库以查找此AS外部LSA:
转发度量
转发度量是从路由器到达ASBR的开销。可使用以下命令检查此情况:
R4#show ipv6 ospf border-routers
OSPFv3 Router with ID (192.168.1.4) (Process ID 10)
Codes: i - Intra-area route, I - Inter-area route
I 192.168.1.1 [3] via FE80::C801:37FF:FE2C:6, FastEthernet0/0, ASBR, Area 0, SPF 2
I 192.168.1.1 [2] via FE80::C802:BFF:FEB4:6, FastEthernet0/1, ASBR, Area 0, SPF 2
i 192.168.1.3 [1] via FE80::C802:BFF:FEB4:6, FastEthernet0/1, ABR, Area 0, SPF 2
i 192.168.1.2 [1] via FE80::C801:37FF:FE2C:6, FastEthernet0/0, ABR, Area 0, SPF 2
I 192.168.1.5 [2] via FE80::C801:37FF:FE2C:6, FastEthernet0/0, ASBR, Area 0, SPF 2
在此输出中,从路由器R4到达ASBR(R1和R5)的开销为2。默认情况下,OSPFv3中快速以太网接口的开销为1。因此,在本例中,从R4到达R1或R5的开销为2:转发度量=到达ABR的路由器开销(1)+到达ASBR的ABR开销(1)= 2。
将R5上的重分发度量也更改为10,因此两条路由都重新安装在IPv6路由表中。
以下是在R5上实施的更改:
R5(config)#ipv6 router ospf 10
R5(config-rtr)#redistribute static metric 10
R4上的IPv6路由表和OSPFv3 RIB显示:
R4#sh ipv6 ospf rib detail
* FD00:AAAA:BBBB:CCCC::/64, Ext-2, cost 10/2
source 192.168.1.1, tag 0
via FE80::C801:37FF:FE2C:6, FastEthernet0/0
via FE80::C802:BFF:FEB4:6, FastEthernet0/1
LSA: 4005/0/192.168.1.5
LSA: 4005/0/192.168.1.1
R4#show ipv6 route FD00:AAAA:BBBB:CCCC::/64
Routing entry for FD00:AAAA:BBBB:CCCC::/64
Known via "ospf 10", distance 110, metric 10, type extern 2
Route count is 2/2, share count 0
Routing paths:
FE80::C802:BFF:FEB4:6, FastEthernet0/1
Last updated 00:09:49 ago
FE80::C801:37FF:FE2C:6, FastEthernet0/0
Last updated 00:00:14 ago
现在,让我们更改到达其中一个ASBR但具有相同重分发度量的开销并检查相同的输出。
增加路由器R4的fa0/1的OSPFv3开销:
R4(config)#int fa0/1
R4(config-if)#ipv6 ospf cost 10
检查转发度量。它显示,现在从Fa0/1接口到达ASBR R1的开销为11:
R4#show ipv6 ospf border-routers
OSPFv3 Router with ID (192.168.1.4) (Process ID 10)
Codes: i - Intra-area route, I - Inter-area route
I 192.168.1.1 [3] via FE80::C801:37FF:FE2C:6, FastEthernet0/0, ASBR, Area 0, SPF 3
I 192.168.1.1 [11] via FE80::C802:BFF:FEB4:6, FastEthernet0/1, ASBR, Area 0, SPF 3
i 192.168.1.3 [10] via FE80::C802:BFF:FEB4:6, FastEthernet0/1, ABR, Area 0, SPF 3
i 192.168.1.2 [1] via FE80::C801:37FF:FE2C:6, FastEthernet0/0, ABR, Area 0, SPF 3
I 192.168.1.5 [2] via FE80::C801:37FF:FE2C:6, FastEthernet0/0, ASBR, Area 0, SPF 3
现在R4上的IPv6路由表和OSPFv3 RIB显示:
R4#sh ipv6 ospf rib detail
* FD00:AAAA:BBBB:CCCC::/64, Ext-2, cost 10/2
source 192.168.1.5, tag 0
via FE80::C801:37FF:FE2C:6, FastEthernet0/0
LSA: 4005/0/192.168.1.5
LSA: 4005/0/192.168.1.1
R4#show ipv6 route FD00:AAAA:BBBB:CCCC::/64
Routing entry for FD00:AAAA:BBBB:CCCC::/64
Known via "ospf 10", distance 110, metric 10, type extern 2
Route count is 1/1, share count 0
Routing paths:
FE80::C801:37FF:FE2C:6, FastEthernet0/0
Last updated 00:02:19 ago
因此,具有较低转发度量的路由会安装到IPv6路由表中。
总之,当您有多个AS — 外部LSA条目时,第一个首选项将指定给度量(重分布度量)。 具有较低度量的路由会安装到IPv6路由表中。如果重分发的度量相同,则向转发度量提供第二个优先级。具有较低转发度量的路由安装在IPv6路由表中。