简介
本文档介绍在运行Cisco IOS®和IOS-XE®的路由器和交换机上过滤OSPF第5类LSA的各种方法。
作者:思科TAC工程师Rohit Nair。
先决条件
要求
本文档没有任何特定的要求。
使用的组件
本文档不限于特定的软件和硬件版本。本文档适用于所有运行思科 IOS 的思科路由器和交换机。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您使用的是真实网络,请确保您已经了解所有命令的潜在影响。
背景信息
OSPF第5类LSA由自治系统边界路由器(ASBR)发起,并在OSPF区域内泛洪。这些路由是通过从其他协议重分发到OSPF或通过重分发已连接或静态路由生成的。
配置
以下示例显示过滤OSPF域内第5类LSA的各种方法。
网络图
初始配置
纽约
interface FastEthernet0/0
ip address 10.12.1.1 255.255.255.0
end
router ospf 1
network 10.12.1.1 0.0.0.0 area 0
[an error occurred while processing this directive]
伦敦
interface FastEthernet0/0
ip address 10.12.1.2 255.255.255.0
end
interface FastEthernet1/0
ip address 10.23.1.1 255.255.255.0
end
router ospf 1
network 10.12.1.2 0.0.0.0 area 0
network 10.23.1.1 0.0.0.0 area 0
[an error occurred while processing this directive]
迪拜
interface FastEthernet0/0
ip address 10.23.1.2 255.255.255.0
end
interface FastEthernet1/0
ip address 192.168.1.1 255.255.255.0
end
router ospf 1
network 10.23.1.2 0.0.0.0 area 0
router eigrp 1
network 192.168.1.1 0.0.0.0
no auto-summary
[an error occurred while processing this directive]
东京
interface FastEthernet0/0
ip address 192.168.1.2 255.255.255.0
end
interface Loopback100
ip address 172.16.1.1 255.255.255.255
end
router eigrp 1
network 172.16.1.1 0.0.0.0
network 192.168.1.2 0.0.0.0
no auto-summary
[an error occurred while processing this directive]
过滤器选项
分发列表
与访问列表或前缀列表关联的分发列表输出功能可用于生成第5类LSA的ASBR。
注意:OSPF中不支持distribute-list out <interface>命令。必须使用distribute-list out <protocol>命令。
以下是ASBR迪拜的示例。分发列表用于定义在OSPF域内通告来自EIGRP的网络:
Standard IP access list 1
10 deny 192.168.1.0, wildcard bits 0.0.0.255
20 permit any
router ospf 1
redistribute eigrp 1 subnets
network 10.23.1.2 0.0.0.0 area 0
distribute-list 1 out eigrp 1
[an error occurred while processing this directive]
在应用上述分发列表后,192.168.1.0 LSA在纽约和伦敦不可见:
纽约:
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
172.16.1.1 192.168.1.1 23 0x80000001 0x003442 0
NewYork#sh ip route 192.168.1.0
% Network not in table
[an error occurred while processing this directive]
伦敦:
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
172.16.1.1 192.168.1.1 152 0x80000001 0x003442 0
London#sh ip route 192.168.1.0
% Network not in table
[an error occurred while processing this directive]
注意:与接口链接的分发列表可用于区域内的任何路由器。但是,这只会限制路由安装在路由表中,不会阻止转发第5类LSA。
汇总地址
在ASBR上,可以在路由器OSPF进程下使用summary-address命令和not-advertise关键字,以停止第5类LSA的传播。
在迪拜,summary-address命令已用于停止172.16.1.0类型5LSA的通告。
迪拜:
router ospf 1
log-adjacency-changes
summary-address 172.16.1.0 255.255.255.0 not-advertise
redistribute eigrp 1 subnets
network 10.23.1.2 0.0.0.0 area 0
[an error occurred while processing this directive]
172.16.1.0 LSA不再存在于纽约和伦敦:
纽约:
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
192.168.1.0 192.168.1.1 112 0x80000001 0x0012B8 0
NewYork#sh ip route 172.16.1.0
% Network not in table
[an error occurred while processing this directive]
伦敦:
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
192.168.1.0 192.168.1.1 172 0x80000001 0x0012B8 0
London#sh ip route 172.16.1.0
% Network not in table
[an error occurred while processing this directive]
Route-map
在将IGP重分发到OSPF时,路由映射也可用于阻止ASBR上生成第5类LSA。
在迪拜,从EIGRP重分发时,路由映射用于拒绝192.168.1.0子网通告到OSPF:
迪拜:
Standard IP access list 1
10 deny 192.168.1.0, wildcard bits 0.0.0.255
20 permit any
route-map REDIS, permit, sequence 10
Match clauses:
ip address (access-lists): 1
Set clauses:
Policy routing matches: 0 packets, 0 bytes
router ospf 1
log-adjacency-changes
redistribute eigrp 1 subnets route-map REDIS
network 10.23.1.2 0.0.0.0 area 0
[an error occurred while processing this directive]
未为192.168.1.0创建第5类LSA:
Type-5 AS External Link States
Link ID ADV Router Age Seq# Checksum Tag
172.16.1.0 192.168.1.1 47 0x80000001 0x003E39 0
[an error occurred while processing this directive]
验证
通过检查show ip ospf database external命令来确认已过滤的LSA是否确实已被阻止,可以完成验证。
故障排除
目前没有针对此配置的故障排除信息。