JNCIP OSPF NSSA Metric Mania – JUNOS 7.2/8.5

junos-ospf-type-7-to-type-5-lsa-convertion-roadmap

接着实验第一部分继续讨论。经过ABR转换后,Harry Reynolds的Metric的计算方式是:该LSA-5的Metric值直接从ABR上的路由继承,而直接通告到骨干区域当中。由于R5收到由R4通告的Metric为12的LSA,根据OSPF对于外部路由LSA-5的Metric计算原则:总的Metric等于外部路由LSA-5的Metric,加上本地路由器到ASBR上的LSA-4, OSPF内部路由Metric。于是R5加上自身到R4的链路开销1,所以:3/8路由在R5上的Metric为12+1=13

进而到达R6的时候便是Harry Reynolds计算出来的14。而这正是我们主要的分歧所在,出现分歧的核心不在OSPF本身对外部路由LSA-5的Metric计算公式本身上面,而在于计算Metric的时候累加到LSA-5上面的从本地路由器到ASBR上的Metric究竟是多少?究竟应该选择哪条LSA-4?换句话说,究竟哪个才是3/8这条外部路由LSA的ASBR? 进而直接怀疑究竟负责转换LSA-7进而产生LSA-5的R4是否就是ASBR?如果根据ASBR自身的定义应该是不成立的,因为ASBR值的是将路由重分布进入OSPF域的路由器。但由于R1产生的LSA-7无法在骨干区域里面泛洪,因此才将负责转换LSA的R4认为是ASBR。

JUNOS 5.2R1.4版本上采用的显然是这样的方式,负责转换的路由器被认为是到达该外部路由3/8的出口,正因为如此,从Harry Reynolds的traceroute记录上可以看到R5选择R4作为到达3/8的下一跳。但作者当年同时已经指出这种机制的缺陷,如果选择R4作为出口,当R4完全脱离骨干区域,但依然与NSSA连接的情况下,NSSA的外部路由LSA-7便成为了黑洞。因为R4依然与NSSA连接,R3依然不能充当LSA转换路由器,通告至骨干区域的LSA-5当中,通告路由器(ADV Rtr) 依然是R4: 10.0.3.4。可由于它已经脱离了骨干区域,对于骨干区域的路由器而言已经失去出口链路,目标网段不可达。

因此,JUNOS 7.2R4.2对上述的潜在问题作了第一次改善(见上图),直接废除了充当LSA转换的R4对于NSSA外部路由的唯一出口的地位。虽然R1重分布进来的LSA-7不能在OSPF骨干区域内通告,然而R1本身仍然为OSPF域内路由器,通过域间路由LSA-3依然能够连接到R1上,追根溯源,3/8这条路由是从哪台路由器上重分布进入OSPF路由域,这台路由器才应该成为骨干路由器对于3/8网段的唯一出口,不应该是R4,而是R1。因此R1才是真正的ASBR,当计算该外部路由的Metric的时候应该由LSA-5内的Metric加上本地路由器到ASBR R1上的链路开销Metric。我们先看一下LSA-5。

nigel@junos7.2# run show ospf database logical-router r5
lsa-id 3.0.0.0 detail

    OSPF AS SCOPE link state database
Type     ID       Adv Rtr   Seq     Age  Opt  Cksum  Len
Extern 3.0.0.0 10.0.3.4 0x80000002  184  0x2  0xf12f  36
  mask 255.0.0.0
  Type 1, TOS 0x0, metric 12, fwd addr 10.0.6.1,
  tag 0.0.0.0

JNCIP OSPF实验: NSSA Metric Mania – JUNOS 7.2R4.2

在JUNOS 7.2R4.2上,LSA-5的通告路由器仍然为R4,Metric同样为R4继承的12,而我们关注的是“forwarding address 10.0.6.1”这一段,因为R4在这里充当的是一个将ASBR地址递归回到R1上的角色,我们可以通过查看R5的OSPF数据库里面的LSA-4确认这一点。

nigel@junos7.2# run show ospf database logical-router r5
asbrsummary area 0 detail

    OSPF link state database, area 0.0.0.0
Type       ID        Adv Rtr   Seq     Age Opt Cksum Len
ASBRSum  10.0.6.1 10.0.3.3 0x80000009  130 0x2 0x72b  28
  mask 0.0.0.0
  TOS 0x0, metric 1
ASBRSum  10.0.6.1 10.0.3.4 0x80000009  131 0x2 0xb25  28
  mask 0.0.0.0
  TOS 0x0, metric 2
ASBRSum *10.0.9.7 10.0.3.5 0x80000009 1030 0x2 0x9d89 28
  mask 0.0.0.0
  TOS 0x0, metric 1

而作为ABR,R3/R4同时产生LSA-4通告到骨干区域,Metric分别为12,根据最短路径优先算法,R5优选R3作为到达ASBR的下一跳。因此,在R5上,Metric值应该是LSA-5里面的12,加上R3 LSA-4的1,再加上R5到R3的开销1: 12+1+1=14

nigel@junos7.2# run show route logical-router r5 3/8 

inet.0: 23 destinations, 23 routes (23 active,
0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

3.0.0.0/8         *[OSPF/150] 01:09:51, metric 14, tag 0
                   > to 10.0.2.2 via fxp2.35

那么到达R6上的时候便自然累加成为15

[edit]
nigel@junos7.2# run show route logical-router r6 3/8    

inet.0: 23 destinations, 23 routes (23 active,
0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

3.0.0.0/8         *[OSPF/150] 01:09:54, metric 15, tag 0
                   > to 10.0.8.6 via fxp2.56

查看路由表以及在r6上traceroute进一步印证我们的观点。

[edit]
nigel@junos7.2# run traceroute 3.0.0.1 logical-router r6
traceroute to 3.0.0.1 (3.0.0.1), 30 hops max,
40 byte packets
 1  10.0.8.6 (10.0.8.6)
    4.263 ms  5.136 ms  0.952 ms
 2  10.0.2.2 (10.0.2.2)
    1.410 ms  1.756 ms  1.959 ms
 3  10.0.4.14 (10.0.4.14)
    2.456 ms  1.845 ms  1.601 ms
 4  10.0.4.14 (10.0.4.14)
    2.962 ms !H  1.839 ms !H  2.360 ms !H

JNCIP OSPF实验: NSSA Metric Mania – JUNOS 8.5R1.14

恢复承认了R1的ASBR地位之后,可以看到JUNOS同时修正了形成次优路径的情况。不但如此,随着JUNOS 8.5的发布,情况得到进一步的改善。既然R4仅仅是一个转换路由器,那么应该做到透明转换,在JUNOS 7.2R4.2上面,转换后的LSA-5继承R4路由表中的Metric依然留下了R4转换路由器的痕迹。可以看到在整个数据包发送流程当中R4并没有充当任何中继的角色,因此从R1到R4之间的链路开销2完全没理由被继承通告到骨干区域当中,而是应该以该LSA-7原有的初始化Metric出现。因此我们查看JUNOS 8.5R1.14上转换后的LSA-5发现,之前从R4继承过来的Metric 12已经被还原为初始化Metric 10。所以R5上的路由表3/8的Metric为10,加上R3 LSA-4的Metric 1,再加R5到R3的Metric 1: 10+1+1=12,最后到达R6上的时候为13

nigel@junos8.5# run show ospf database logical-router r5
lsa-id 3.0.0.0 detail

    OSPF AS SCOPE link state database
Type     ID       Adv Rtr   Seq     Age  Opt  Cksum  Len
Extern 3.0.0.0 10.0.3.4 0x80000009  226  0x22 0xed0e  36
  mask 255.0.0.0
  Type 1, TOS 0x0, metric 10, fwd addr 10.0.6.1,
  tag 0.0.0.0

[edit]
nigel@junos8.5# run show route logical-router r5 3/8 

inet.0: 23 destinations, 23 routes (23 active,
0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

3.0.0.0/8         *[OSPF/150] 03:22:20, metric 12, tag 0
                   > to 10.0.2.2 via fxp2.35

[edit]
nigel@junos8.5# run show route logical-router r6 3/8    

inet.0: 23 destinations, 23 routes (23 active,
0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

3.0.0.0/8         *[OSPF/150] 03:22:24, metric 13, tag 0
                   > to 10.0.8.6 via fxp2.56
Advertisements

One thought on “JNCIP OSPF NSSA Metric Mania – JUNOS 7.2/8.5

  1. Hi Meng

    Great job, explained my worries with this part of lab, which i have already thought this is depend on the junos versions. But, i have got another problem here which i can not figure out my self.

    The book for ospf routing policy part, it begins with injecting the 10.0.5/24 network with metric type 2, metric 50, tag 420 into the area 10, on both r1 and r2, but when you checking the forwarding path on r3, it is showing that next-hop for 10.0.5/24 is not directly to r1 but to r2 over the 10.0.4.0/30 link.

    lab@Main# run show ospf database logical-router r3 lsa-id 10.0.5.0 detail

    OSPF link state database, Area 0.0.0.10
    Type ID Adv Rtr Seq Age Opt Cksum Len
    NSSA 10.0.5.0 10.0.6.1 0x8000000d 707 0x28 0x9302 36
    mask 255.255.255.0
    Type 2, TOS 0x0, metric 50, fwd addr 10.0.6.1, tag 0.0.1.164
    NSSA 10.0.5.0 10.0.6.2 0x80000009 106 0x28 0xa3f3 36
    mask 255.255.255.0
    Type 2, TOS 0x0, metric 50, fwd addr 10.0.6.2, tag 0.0.1.164
    OSPF AS SCOPE link state database
    Type ID Adv Rtr Seq Age Opt Cksum Len
    Extern 10.0.5.0 10.0.3.4 0x8000000a 1688 0x22 0x217e 36
    mask 255.255.255.0
    Type 2, TOS 0x0, metric 50, fwd addr 10.0.6.2, tag 0.0.1.164

    [edit]
    lab@Main# run show route 10.0.5 logical-router r3

    inet.0: 28 destinations, 28 routes (28 active, 0 holddown, 0 hidden)
    + = Active Route, – = Last Active, * = Both

    10.0.5.0/24 *[OSPF/150] 00:28:14, metric 50, tag 420
    > to 10.0.4.2 via fxp2.103

    if you could shed some light, would be gr8

    Best Rgds,

    Guan

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s