OSPF依靠LSA来描述链路,计算构建路由。其SPF算法的目的是计算出去往目的的理论最短路径。

因为默认LSA只能描述AS内部的路径,所以去往外部目的选择经过ASBR经常会使流量走多余跳数。为了避免这个问题在记录外部的LSAT5 , T7)中引进一个forwarding-address参数用于记录AS以外路径。这样OSPF会通过forwarding-address去往外部目的,并不一定需要经过ASBR

对于T5-LSA,与T7-LSA  forwarding-address的记录规则有所区别。

 


 

T5-LSA external-LSA

当满足下列所有情况的时候,forwarding-address记录外部路径下一跳IP

AND ♦ OSPF is enabled on the ASBR's next hop interface

AND ♦ ASBR's next hop interface is non−passive under OSPF

AND ♦ ASBR's next hop interface is not point−to−point

AND ♦ ASBR's next hop interface is not point−to−multipoint

AND ♦ ASBR's next hop interface address falls under the network range specified in the router ospf command

否则forwarding-address=0.0.0.0,表示ASBR自己是下一跳(需要注意的是,在非NSSA区域的ASBR上对T-5LSA做汇总,会导致forward-address变为0.0.0.0)


-----检查LSA可用性---------------------------------------------------

*   If the metric specified by the LSA is LSInfinity, or if the age of the LSA equals MaxAge, do
nothing with this LSA

*   If the LSA was originated by the calculating router itself, do nothing with this LSA

*   Look up the routing table entries (potentially one per attached area) for the ASBR that originated the LSA.

    If no entries exist for router ASBR (i.e., ASBR is unreachable), do nothing with this LSA

*   If the forwarding address is non−zero, look up the forwarding address in the routing table.

    The matching routing table entry must specify an intra−area or inter−area path; if no such path exists, do nothing with the LSA and consider the next in the list.

    PS:此条解释了上面条件最后一个条件,为什么必须要在外部设备起OSPF宣告下一跳,去往forwarding-address的路由在RIB里一定要是OSPF域内或域间路由

 


 

T7-LSA NSSA-external-LSA

Ospf所有消息都包含一个option标志位,占用1个字节空间,ospf headeroption用于标示设备能力,ospf LSA中的option用于对LSA进行控制。

其中第5bitospf header option中叫做Nnssa)比特位,表示设备可产生T7-LSA;LSA中叫做Ppropagate)比特位,用于向NSSA-ABR传达可将此T7-LSA转换成T5-LSA传至其他区域

RFC31012.3章节有描述:

If the p-bit is set , the forwarding address must be non-zero; otherwise it may be 0.0.0.0

默认T7-LSA P-bit都为1,所以生成T7-LSA必然会携带非0 forwarding-address

NSSA Forwarding-address选择方式:

1. 外部路由在ASBR路由表中存在直连下一跳IP,且连该下一跳的接口被激活在NSSA intra-area内,则forwarding-address=该外部路由下一跳IP

2. 其他情况,在该ASBR所有激活在OSPF下的活跃接口中,按选OSPF RID的方法选出最大IP作为forwarding-adress

如果想让T7-LSA丧失p-bit功能,思科设备实现在ASBR做重分发时加nssa-only选项即可,但并不会导致forwarding-address置为0,注意上RFC说法。

如果是想将T7-LSAforwarding-address置为0.0.0.0 不同厂商可能做法不同,由于意义不大,实现上厂商技术文档并没有提及

在思科设备上,当本设备拥有最大IPOSPF活跃接口不属于NSSA区域时,可以实现forwarding-address=0,此时T7-LSA  p-bit自动为0,则该LSA也是不会转T5-LSA传出NSSA区域。(该功能应该是后期添加,测试使用IOS 15.0(1)M4版本)

 

-----检查LSA可用性---------------------------------------------------

*     第一二三条上面一样

*     For a Type-5 LSA the matching routing table entry must specify an intra-area or inter-area path through a Type-5 capable area. 

       For a Type-7 LSA the matching routing table entry must specify an intra-area path through the LSA's originating NSSA. 

       If no such path exists, then do nothing with this LSA