此产品的文档集力求使用非歧视性语言。在本文档集中,非歧视性语言是指不隐含针对年龄、残障、性别、种族身份、族群身份、性取向、社会经济地位和交叉性的歧视的语言。由于产品软件的用户界面中使用的硬编码语言、基于 RFP 文档使用的语言或引用的第三方产品使用的语言,文档中可能无法确保完全使用非歧视性语言。 深入了解思科如何使用包容性语言。
思科采用人工翻译与机器翻译相结合的方式将此文档翻译成不同语言,希望全球的用户都能通过各自的语言得到支持性的内容。 请注意:即使是最好的机器翻译,其准确度也不及专业翻译人员的水平。 Cisco Systems, Inc. 对于翻译的准确性不承担任何责任,并建议您总是参考英文原始文档(已提供链接)。
本文档介绍在OSPF(开放最短路径优先)域中由ASBR(自治系统边界路由器)为外部LSA(链路状态通告)选择转发地址时使用的概念。
本文档的读者应掌握以下这些主题的相关知识:
本文档不限于特定的软件和硬件版本。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您使用的是真实网络,请确保您已经了解所有命令的潜在影响。
以下图像将用作文档其余部分的示例拓扑。
R3使用路由映射将网络192.168.20.0/24重分发到OSPF NSSA(非末节区域)。您可以使用任何方法将路由重分布到OSPF域。
R3的相关配置:
router ospf 1
router-id 192.168.3.3
area 1 nssa
redistribute connected metric-type 1 subnets route-map CONN
network 10.143.31.0 0.0.0.255 area 1
route-map CONN, permit, sequence 10
Match clauses:
interface Ethernet0/1
Set clauses:
Policy routing matches: 0 packets, 0 bytes
interface Ethernet0/1
ip address 192.168.20.1 255.255.255.0
不同路由器之间的OSPF邻居关系:
R1#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.3.3 0 FULL/ - 00:00:38 10.143.31.234 Ethernet0/2
R2#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.3.3 0 FULL/ - 00:00:36 10.143.31.230 Ethernet0/0
R3#sh ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface
192.168.1.1 0 FULL/ - 00:00:34 10.143.31.233 Ethernet0/2
192.168.2.2 0 FULL/ - 00:00:30 10.143.31.229 Ethernet0/0
如果查看R1和R2上外部路由“192.168.20.0”的度量,您会发现R1上的度量为30,R2上的度量为40。即使它们以相同方式连接到R3,也会有所不同。
R1#sh ip route 192.168.20.0
Routing entry for 192.168.20.0/24
Known via "ospf 1", distance 110, metric 30, type NSSA extern 1
Last update from 10.143.31.234 on Ethernet0/2, 00:00:31 ago
Routing Descriptor Blocks:
* 10.143.31.234, from 192.168.3.3, 00:00:31 ago, via Ethernet0/2
Route metric is 30, traffic share count is 1
R2#sh ip route 192.168.20.0
Routing entry for 192.168.20.0/24
Known via "ospf 1", distance 110, metric 40, type NSSA extern 1
Last update from 10.143.31.230 on Ethernet0/0, 00:00:26 ago
Routing Descriptor Blocks:
* 10.143.31.230, from 192.168.3.3, 00:00:26 ago, via Ethernet0/0
Route metric is 40, traffic share count is 1
R1和R2上此前缀的LSA信息:
R1#sh ip ospf database nssa-external
OSPF Router with ID (192.168.1.1) (Process ID 1)
Type-7 AS External Link States (Area 1)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 334
Options: (No TOS-capability, Type 7/5 translation, DC, Upward)
LS Type: AS External Link
Link State ID: 192.168.20.0 (External Network Number )
Advertising Router: 192.168.3.3
LS Seq Number: 80000003
Checksum: 0xA0E3
Length: 36
Network Mask: /24
Metric Type: 1 (Comparable directly to link state metric)
MTID: 0
Metric: 20
Forward Address: 10.143.31.234
External Route Tag: 0
R2#sh ip ospf database nssa-external
OSPF Router with ID (192.168.2.2) (Process ID 1)
Type-7 AS External Link States (Area 1)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 352
Options: (No TOS-capability, Type 7/5 translation, DC, Upward)
LS Type: AS External Link
Link State ID: 192.168.20.0 (External Network Number )
Advertising Router: 192.168.3.3
LS Seq Number: 80000003
Checksum: 0xA0E3
Length: 36
Network Mask: /24
Metric Type: 1 (Comparable directly to link state metric)
MTID: 0
Metric: 20
Forward Address: 10.143.31.234
External Route Tag: 0
您可以看到R1和R2上第7类LSA的转发地址相同。此转发地址属于R3和R1之间的接口。此转发地址直接连接到R1,但R2可通过R3访问。这意味着转发地址离R2的一跳。
如果R3选择R3和R2之间链路的IP地址作为转发地址,R1上将出现类似情况。
在ASBR上使用以下规则选择转发地址:
R3#sh ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Et0/2 1 1 10.143.31.234/30 10 P2P 1/1
Et0/0 1 1 10.143.31.230/30 10 P2P 1/1
Et0/2显示在“show ip ospf interface brief”顶部,这是选择其IP地址作为转发地址的原因。
将Et0/0的配置更改为默认配置将使其与OSPF分离。再次添加配置会将其连回OSPF。 此后,Et0/0将列在“show ip ospf interface brief”输出顶部。
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#
R3(config)#default interface e0/0
Interface Ethernet0/0 set to default configuration
*Aug 3 11:25:47.625: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.2.2 on Ethernet0/0 from FULL to DOWN, Neighbor Down: Interface down or detached
R3(config)#interface Ethernet0/0
R3(config-if)# ip address 10.143.31.230 255.255.255.252
R3(config-if)# ip ospf network point-to-point
R3(config-if)#end
R3#*Aug 3 11:26:03.995: %OSPF-5-ADJCHG: Process 1, Nbr 192.168.2.2 on Ethernet0/0 from LOADING to FULL, Loading Done
R3#sh ip ospf interface brief
Interface PID Area IP Address/Mask Cost State Nbrs F/C
Et0/0 1 1 10.143.31.230/30 10 P2P 1/1
Et0/2 1 1 10.143.31.234/30 10 P2P 1/1
此更改将导致重新计算转发地址到Et0/0上配置的IP地址的转发地址。
R1#sh ip ospf database nssa-external
OSPF Router with ID (192.168.1.1) (Process ID 1)
Type-7 AS External Link States (Area 1)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 284
Options: (No TOS-capability, Type 7/5 translation, DC, Upward)
LS Type: AS External Link
Link State ID: 192.168.20.0 (External Network Number )
Advertising Router: 192.168.3.3
LS Seq Number: 80000004
Checksum: 0x6621
Length: 36
Network Mask: /24
Metric Type: 1 (Comparable directly to link state metric)
MTID: 0
Metric: 20
Forward Address: 10.143.31.230
External Route Tag: 0
R2#sh ip ospf database nssa-external
OSPF Router with ID (192.168.2.2) (Process ID 1)
Type-7 AS External Link States (Area 1)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 303
Options: (No TOS-capability, Type 7/5 translation, DC, Upward)
LS Type: AS External Link
Link State ID: 192.168.20.0 (External Network Number )
Advertising Router: 192.168.3.3
LS Seq Number: 80000004
Checksum: 0x6621
Length: 36
Network Mask: /24
Metric Type: 1 (Comparable directly to link state metric)
MTID: 0
Metric: 20
Forward Address: 10.143.31.230
External Route Tag: 0
现在,“show ip route”的输出将显示R1上到达外部路由的度量为40,R2上到达外部路由的度量为30。这与之前的输出相反。
R1#sh ip route 192.168.20.0
Routing entry for 192.168.20.0/24
Known via "ospf 1", distance 110, metric 40, type NSSA extern 1
Last update from 10.143.31.234 on Ethernet0/2, 00:06:14 ago
Routing Descriptor Blocks:
* 10.143.31.234, from 192.168.3.3, 00:06:14 ago, via Ethernet0/2
Route metric is 40, traffic share count is 1
R2#sh ip route 192.168.20.0
Routing entry for 192.168.20.0/24
Known via "ospf 1", distance 110, metric 30, type NSSA extern 1
Last update from 10.143.31.230 on Ethernet0/0, 00:06:29 ago
Routing Descriptor Blocks:
* 10.143.31.230, from 192.168.3.3, 00:06:29 ago, via Ethernet0/0
Route metric is 30, traffic share count is 1
此更改可能不可预测,并会导致网络收敛,因此建议将环回IP地址作为转发地址。
R3(config)#int lo0
R3(config-if)#ip address 192.168.3.3 255.255.255.255
R3(config-if)#router ospf 1
R3(config-router)#network 192.168.3.3 0.0.0.0 area 1
R3(config-router)#end
这也会导致R1和R2上的度量相等:
R1#sh ip ospf database nssa-external
OSPF Router with ID (192.168.1.1) (Process ID 1)
Type-7 AS External Link States (Area 1)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 1
Options: (No TOS-capability, Type 7/5 translation, DC, Upward)
LS Type: AS External Link
Link State ID: 192.168.20.0 (External Network Number )
Advertising Router: 192.168.3.3
LS Seq Number: 80000005
Checksum: 0x872F
Length: 36
Network Mask: /24
Metric Type: 1 (Comparable directly to link state metric)
MTID: 0
Metric: 20
Forward Address: 192.168.3.3
External Route Tag: 0
R1#sh ip route 192.168.20.0
Routing entry for 192.168.20.0/24
Known via "ospf 1", distance 110, metric 31, type NSSA extern 1
Last update from 10.143.31.234 on Ethernet0/2, 00:01:27 ago
Routing Descriptor Blocks:
* 10.143.31.234, from 192.168.3.3, 00:01:27 ago, via Ethernet0/2
Route metric is 31, traffic share count is 1
R2#sh ip ospf database nssa-external
OSPF Router with ID (192.168.2.2) (Process ID 1)
Type-7 AS External Link States (Area 1)
Routing Bit Set on this LSA in topology Base with MTID 0
LS age: 6
Options: (No TOS-capability, Type 7/5 translation, DC, Upward)
LS Type: AS External Link
Link State ID: 192.168.20.0 (External Network Number )
Advertising Router: 192.168.3.3
LS Seq Number: 80000005
Checksum: 0x872F
Length: 36
Network Mask: /24
Metric Type: 1 (Comparable directly to link state metric)
MTID: 0
Metric: 20
Forward Address: 192.168.3.3
External Route Tag: 0
R2#sh ip route 192.168.20.0
Routing entry for 192.168.20.0/24
Known via "ospf 1", distance 110, metric 31, type NSSA extern 1
Last update from 10.143.31.230 on Ethernet0/0, 00:01:57 ago
Routing Descriptor Blocks:
* 10.143.31.230, from 192.168.3.3, 00:01:57 ago, via Ethernet0/0
Route metric is 31, traffic share count is 1
注意:有关外部LSA的非零转发地址的详细信息,请参阅OSPF转发地址的常见路由问题。