运行OSPF多区域,其中区域1为NSSA
R4上引入外部路由,默认7转5的转换者为R3(router-id大的成为转换者)
设置R2为转换者,查看lsdb是否转换者变为R2,查看R1环回口访问R4的环回口路径
清除FA地址,使R1环回口能够访问R4的环回口
R2依旧为转换者路由器,取消抑制FA地址,在R1上过滤掉FA地址网段的路由,使R1环回口能够访问R4的环回口
sysname AR1
#
interface GigabitEthernet0/0/0
ip address 10.0.12.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.13.1 255.255.255.0
#
interface LoopBack0
ip address 10.1.1.1 255.255.255.255
#
ospf 1 router-id 10.1.1.1
area 0.0.0.0
network 0.0.0.0 255.255.255.255
#
sysname AR2
#
interface GigabitEthernet0/0/0
ip address 10.0.12.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.23.2 255.255.255.0
#
ospf 1 router-id 10.2.2.2
area 0.0.0.0
network 10.0.12.2 0.0.0.0
area 0.0.0.1
network 10.0.23.2 0.0.0.0
nssa
#
sysname AR3
#
interface Serial1/0/0
ip address 10.0.34.3 255.255.255.0
#
interface GigabitEthernet0/0/0
ip address 10.0.23.3 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.13.3 255.255.255.0
#
ospf 1 router-id 10.3.3.3
area 0.0.0.0
network 10.0.13.3 0.0.0.0
area 0.0.0.1
network 10.0.23.3 0.0.0.0
network 10.0.34.3 0.0.0.0
nssa
#
sysname AR4
#
interface Serial1/0/0
ip address 10.0.34.4 255.255.255.0
#
interface LoopBack0
ip address 10.4.4.4 255.255.255.255
#
ospf 1 router-id 10.4.4.4
import-route direct route-policy D->O
area 0.0.0.1
network 10.0.34.4 0.0.0.0
nssa
#
route-policy D->O permit node 10
if-match ip-prefix L0
#
ip ip-prefix L0 index 10 permit 10.4.4.4 32
#
AR1收到的10.4.4.4的外部路由,7转5的转换者为R3,FA地址为10.0.34.4
FA地址产生条件:
AR1去往外部路由10.4.4.4的路径AR3->AR4
AR2上使用nssa translator-always命令将7—5类转化者路由器设置为AR2
ospf
area 1
nssa translator-always
AR1上查看外部路由发现通告路由器变为AR2
此时由于FA地址的存在,AR1去往10.4.4.4不会经过AR2,避免了次优路径
AR1去往10.4.4.4,依旧经过AR3->AR4
此时在AR2上配置nssa translator-always suppress-forwarding-address命令,将FA地址清除
AR1上查看,FA地址为0.0.0.0
AR2:
ospf 1
area 1
nssa translator-always suppress-forwarding-address
#
此时AR1访问10.4.4.4的下一跳为AR2,当包到达AR3,AR3会把包发给AR1,将出现环路:
原因:AR3的路由表去往10.4.4.4的下一跳为AR1,形成环路
Q:为什么AR3去往10.4.4.4的下一跳为AR1
A:AR3同时收到关于10.4.4.4的5类和7类LSA,通告者路由器分别为AR2和AR4,外部路由类型默认为type-2(cost为1),比较到ASBR的cost,显然收到的5类LSA到ASBR的cost小于7类LSA到ASBR的cost,故选择AR2通告的外部路由。
通过修改cost值消除环路
interface Serial1/0/0
ospf cost 1
#
查看AR3路由表,去往10.4.4.4的下一跳为AR4
AR1去往10.4.4.4的路径,AR2->AR3-AR4
恢复FA地址
AR2:
ospf
area 1
nssa translator-always
依然使用AR2作为7类转5类LSA的转换者
过滤前AR1路由表
AR1上过滤掉10.0.34.0网段的路由信息,可以看到到FA地址网段的路由消失,外部路由由于下一跳不可达,也一并消失
ip ip-prefix net34 index 10 deny 10.0.34.0 24
ip ip-prefix net34 index 20 permit 0.0.0.0 0 less-equal 32
#
ospf 1 router-id 10.1.1.1
filter-policy ip-prefix net34 import
#
过滤后AR1路由表
AR1无法访问AR4,此时,清除FA地址,并设置AR3的s1/0/0接口的开销,避免上述环路,使得AR1可访问AR4
ospf 1
area 1
nssa translator-always suppress-forwarding-address
#
interface Serial1/0/0
ospf cost 1
#
查看AR1的路由表,到AR4的环回口10.4.4.4的路由出现,下一跳为AR2
AR1访问AR4,路径AR2->AR3->AR4