码迷,mamicode.com
首页 > 其他好文 > 详细

8. OSPF的NSSA详解

时间:2020-07-11 22:40:14      阅读:63      评论:0      收藏:0      [点我收藏+]

标签:操作   tag   ati   nal   ctrl   bytes   abi   address   flags   

1. OSPF的NSSA(not so stub area)区域

  • 不接收5类LSA,但是可以引入外部路由,引入一种新的7类的NSSA的LSA

  • 场景:一个分支现在不接收5类LSA,同时还要在本区域得到默认路由去指向运行商而不是总公司(area 0)

[SW3-ospf-1]ar
[SW3-ospf-1]area 15
[SW3-ospf-1-area-0.0.0.15]
[SW3-ospf-1-area-0.0.0.15]nssa 
Error: The specified area has been configured as a STUB area. //需要先拿掉STUB的配置,然后再配置NSSA

[R5-ospf-1-area-0.0.0.15]dis th
[V200R003C00]
#
 area 0.0.0.15 
  nssa   //该区域中所有设备都配置nssa,否则NP位不一致,导致无法建立邻居
  
  
  
[SW3-ospf-1-area-0.0.0.15]dis ospf peer brief 

         OSPF Process 1 with Router ID 13.13.13.13
                  Peer Statistic Information
----------------------------------------------------------------------------
 Area Id          Interface                        Neighbor id      State    
 0.0.0.15         Vlanif30                         0.0.0.1          Full        

 0.0.0.15         Vlanif30                         5.5.5.5          Full        




[SW3]dis ip routing-table protocol ospf

Route Flags: R - relay, D - download to fib
Public routing table : OSPF
         Destinations : 13       Routes : 14       
OSPF routing table status : <Active>
         Destinations : 13       Routes : 14
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   O_NSSA  150  1           D   10.1.15.1       Vlanif30
                    O_NSSA  150  1           D   10.1.15.5       Vlanif30 //华为设备上默认从ABR(s)处得到7类LSA产生的默认路由,这点在思科设备上不会自动产生  
       10.1.1.1/32  OSPF    10   1           D   10.1.15.1       Vlanif30
       10.1.1.4/32  OSPF    10   49          D   10.1.15.1       Vlanif30
       10.1.1.5/32  OSPF    10   1           D   10.1.15.5       Vlanif30
      10.1.34.0/24  OSPF    10   97          D   10.1.15.1       Vlanif30
      10.1.35.0/24  OSPF    10   2           D   10.1.15.5       Vlanif30
      10.1.56.0/24  OSPF    10   49          D   10.1.15.5       Vlanif30
       11.1.1.1/32  OSPF    10   1           D   10.1.15.1       Vlanif30
       33.1.1.1/32  OSPF    10   2           D   10.1.15.5       Vlanif30
       44.1.1.1/32  OSPF    10   49          D   10.1.15.1       Vlanif30
       55.1.1.1/32  OSPF    10   1           D   10.1.15.5       Vlanif30
       66.1.1.1/32  OSPF    10   49          D   10.1.15.5       Vlanif30
      100.1.1.1/32  O_NSSA  150  1           D   10.1.15.1       Vlanif30 //不同于STUB区域,此时NSSA区域得到了本区域引入的7类LSA产生的外部路由(其他区域引入的外部路由通过默认路由去访问)


[R6-ospf-1]import-route direct

[SW3]dis ip routing-table protocol ospf   //NSSA内部的设备看不到其他区域引入的外部路由,但是可以通过默认路由去访问  

Route Flags: R - relay, D - download to fib

Public routing table : OSPF
         Destinations : 13       Routes : 14       

OSPF routing table status : <Active>
         Destinations : 13       Routes : 14

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   O_NSSA  150  1           D   10.1.15.1       Vlanif30
                    O_NSSA  150  1           D   10.1.15.5       Vlanif30
       10.1.1.1/32  OSPF    10   1           D   10.1.15.1       Vlanif30
       10.1.1.4/32  OSPF    10   49          D   10.1.15.1       Vlanif30
       10.1.1.5/32  OSPF    10   1           D   10.1.15.5       Vlanif30
      10.1.34.0/24  OSPF    10   97          D   10.1.15.1       Vlanif30
      10.1.35.0/24  OSPF    10   2           D   10.1.15.5       Vlanif30
      10.1.56.0/24  OSPF    10   49          D   10.1.15.5       Vlanif30
       11.1.1.1/32  OSPF    10   1           D   10.1.15.1       Vlanif30
       33.1.1.1/32  OSPF    10   2           D   10.1.15.5       Vlanif30
       44.1.1.1/32  OSPF    10   49          D   10.1.15.1       Vlanif30
       55.1.1.1/32  OSPF    10   1           D   10.1.15.5       Vlanif30
       66.1.1.1/32  OSPF    10   49          D   10.1.15.5       Vlanif30
      100.1.1.1/32  O_NSSA  150  1           D   10.1.15.1       Vlanif30

OSPF routing table status : <Inactive>
         Destinations : 0        Routes : 0



[SW3]ping 6.6.6.6
  PING 6.6.6.6: 56  data bytes, press CTRL_C to break
    Reply from 6.6.6.6: bytes=56 Sequence=1 ttl=254 time=70 ms
    Reply from 6.6.6.6: bytes=56 Sequence=2 ttl=254 time=50 ms
    Reply from 6.6.6.6: bytes=56 Sequence=3 ttl=254 time=50 ms
    Reply from 6.6.6.6: bytes=56 Sequence=4 ttl=254 time=50 ms
    Reply from 6.6.6.6: bytes=56 Sequence=5 ttl=254 time=50 ms

  --- 6.6.6.6 ping statistics ---
    5 packet(s) transmitted
    5 packet(s) received
    0.00% packet loss
    round-trip min/avg/max = 50/54/70 ms
    
    
    
[SW3]ip route-static 0.0.0.0 0 NULL 0 //OSPF不可以通过引入默认静态路由产生

1.1 NSSA的特点:

  • 本区域可以为所欲为的引入外部路由,其他区域引入的外部路由不接受(只许州官放火不许百姓点灯)

1.2 7类NSSA的LSA

  • 为了将NSSA区域引入的外部路由发布到其他区域,要把 7类LSA 转为 5类LSA,以便在整个OSPF为了中通告
  • P-bit,用于告知转化路由器,该条 7类LSA 是否需要转化,dis ospf lsdb nssa 133.1.1.1
  • 缺省情况下,转换路由器是NSSA区域中 RID 最大的ABR
  • 只有 P-bit 置位并且 转发地址不为 0 的7类LSA 才能转化为 5类LSA,转发地址用来表示发送的某个目的地址的报文将被转发到转发地址所指定的地址
  • ABR产生的 7类LSA 不会置位 P-bit

1.3 7类LSA

通告者:NSSA区域的ASBR

通告范围:仅仅在NSSA区域(更新到NSSA区域外会变成5类LSA)

内容和功能:描述NSSA区域产生的外部路由(网络前缀、掩码、度量、类型、转发地址、tag)

[SW3]dis ospf lsdb nssa 100.1.1.1      

         OSPF Process 1 with Router ID 13.13.13.13
                         Area: 0.0.0.15
                 Link State Database 

  Type      : NSSA
  Ls id     : 100.1.1.1
  Adv rtr   : 0.0.0.1  
  Ls age    : 1526 
  Len       : 36 
  Options   : None 
  seq#      : 80000001 
  chksum    : 0xd40
  Net mask  : 255.255.255.255 
  TOS 0  Metric: 1 
  E type    : 2
  Forwarding Address : 10.1.15.1 //NSSA LSA的转发地址一般都去非0
  Tag       : 1 

  Priority  : Medium

[SW3]ip route-static 133.1.1.1 32 NULL 0
[SW3]ospf
[SW3-ospf-1]import-route static 


[SW3-ospf-1]dis ospf lsdb nssa self-originate 

         OSPF Process 1 with Router ID 13.13.13.13
                         Area: 0.0.0.15
                 Link State Database 

  Type      : NSSA
  Ls id     : 133.1.1.1
  Adv rtr   : 13.13.13.13  
  Ls age    : 37 
  Len       : 36 
  Options   :  NP    //P代表可以转换
  seq#      : 80000001 
  chksum    : 0x806e
  Net mask  : 255.255.255.255 
  TOS 0  Metric: 1 
  E type    : 2
  Forwarding Address : 10.1.15.3 
  Tag       : 1 
  Priority  : Low
  
  
//默认情况下是NSSA区域的ABR(RID较大的ABR,防环的角度)进行的7-->5
<R3>dis ip routing-table 133.1.1.1    

Route Flags: R - relay, D - download to fib
Routing Table : Public
Summary Count : 1
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

      133.1.1.1/32  O_ASE   150  1           D   10.1.35.5       GigabitEthernet0/0/0



<R3>dis ospf lsdb ase 133.1.1.1

         OSPF Process 1 with Router ID 33.1.1.1
                 Link State Database

  Type      : External
  Ls id     : 133.1.1.1
  Adv rtr   : 5.5.5.5 //是NSSA区域的ABR设备做了7转5,
  Ls age    : 318 
  Len       : 36 
  Options   :  E  
  seq#      : 80000001 
  chksum    : 0xe72f
  Net mask  : 255.255.255.255 
  TOS 0  Metric: 1 
  E type    : 2
  Forwarding Address : 10.1.15.3 
  Tag       : 1 
  Priority  : Medium
  
  
  
  
<R3>dis ospf abr-asbr 

         OSPF Process 1 with Router ID 33.1.1.1
                 Routing Table to ABR and ASBR 
 RtType      Destination       Area       Cost  Nexthop         Type
 Intra-area  0.0.4.4           0.0.0.34   48    10.1.34.4       ABR 
 Intra-area  5.5.5.5           0.0.0.35   1     10.1.35.5       ABR/ASBR //对ASBR的进一步理解:只要产生了5类LSA就是ASBR
 Inter-area  0.0.0.1           0.0.0.35   49    10.1.35.5       ASBR 

 Inter-area  0.0.0.6           0.0.0.35   49    10.1.35.5       ASBR 

1.4 NSSA 参数

技术图片

1.5 NSSA的细节:

1.5.1 no-summary 之后ABR产生3类的默认路由

ospf
  area 15 
	 nssa no-summary
	 
no-summary之后,ABR产生几类的默认路由?3类。OSPF形式的默认路由只能以3、5、7类存在

<SW3>dis ospf routing 

         OSPF Process 1 with Router ID 13.13.13.13
                  Routing Tables 
 Routing for Network 
 Destination        Cost  Type       NextHop         AdvRouter       Area
 10.1.15.0/24       1     Transit    10.1.15.3       13.13.13.13     0.0.0.15
 0.0.0.0/0          2     Inter-area 10.1.15.1       0.0.0.1         0.0.0.15
 0.0.0.0/0          2     Inter-area 10.1.15.5       5.5.5.5         0.0.0.15

 Total Nets: 3  
 Intra Area: 1  Inter Area: 2  ASE: 0  NSSA: 0 



<SW3>dis ip rou pro ospf

Route Flags: R - relay, D - download to fib
Public routing table : OSPF
         Destinations : 1        Routes : 2        
OSPF routing table status : <Active>
         Destinations : 1        Routes : 2
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   OSPF    10   2           D   10.1.15.5       Vlanif30
                    OSPF    10   2           D   10.1.15.1       Vlanif30

OSPF routing table status : <Inactive>

          Destinations : 0        Routes : 0

1.5.2 ABR同时也是ASBR的设备引入外部路由,NP不置位,因为这不需要把7类再转成5类,ASBR本身就产生了5类LSA。

[R1-ospf-1]import-route static
[R1-ospf-1]dis ospf lsdb nssa self-originate 

         OSPF Process 1 with Router ID 0.0.0.1
                         Area: 0.0.0.0
                 Link State Database 
    
                         Area: 0.0.0.15
                 Link State Database 

  Type      : NSSA
  Ls id     : 100.1.1.1
  Adv rtr   : 0.0.0.1  
  Ls age    : 16 
  Len       : 36 
  Options   : None 
  seq#      : 80000001 
  chksum    : 0xd40
  Net mask  : 255.255.255.255             
  TOS 0  Metric: 1 
  E type    : 2
  Forwarding Address : 10.1.15.1 
  Tag       : 1 
  Priority  : Low




[R1-ospf-1]dis ospf lsdb ase self-originate 

         OSPF Process 1 with Router ID 0.0.0.1
                 Link State Database

  Type      : External
  Ls id     : 100.1.1.1
  Adv rtr   : 0.0.0.1  
  Ls age    : 46 
  Len       : 36 
  Options   :  E  
  seq#      : 80000001 
  chksum    : 0xbea9
  Net mask  : 255.255.255.255 
  TOS 0  Metric: 1 
  E type    : 2
  Forwarding Address : 0.0.0.0 
  Tag       : 1 

  Priority  : Low

1.5.3 translator-always Set NSSA translator role always //总是进行7转5的操作

translator-always         Set NSSA translator role always //总是进行7转5的操作
R1上配置该命令,结果
<R4>dis ospf lsdb ase 133.1.1.1 //开始看到的情况R1和R5都做了转换

         OSPF Process 1 with Router ID 0.0.4.4
                 Link State Database


  Type      : External
  Ls id     : 133.1.1.1
  Adv rtr   : 5.5.5.5  
  Ls age    : 825 
  Len       : 36 
  Options   :  E  
  seq#      : 80000001 
  chksum    : 0xe72f
  Net mask  : 255.255.255.255 
  TOS 0  Metric: 1 
  E type    : 2
  Forwarding Address : 10.1.15.3 
  Tag       : 1 
  Priority  : Medium

  Type      : External
  Ls id     : 133.1.1.1
  Adv rtr   : 0.0.0.1  
  Ls age    : 36 
  Len       : 36 
  Options   :  E  
  seq#      : 80000001 
  chksum    : 0x78b1
  Net mask  : 255.255.255.255             
  TOS 0  Metric: 1 
  E type    : 2
  Forwarding Address : 10.1.15.3 
  Tag       : 1 
  Priority  : Medium
<R4>dis ospf lsdb ase 133.1.1.1

         OSPF Process 1 with Router ID 0.0.4.4
                 Link State Database


  Type      : External
  Ls id     : 133.1.1.1
  Adv rtr   : 0.0.0.1  
  Ls age    : 175 
  Len       : 36 
  Options   :  E  
  seq#      : 80000001 
  chksum    : 0x78b1
  Net mask  : 255.255.255.255 
  TOS 0  Metric: 1 
  E type    : 2
  Forwarding Address : 10.1.15.3 
  Tag       : 1 
  Priority  : Medium
<R5>dis ospf lsdb ase 133.1.1.1 self-originate //R5不在做7转5的转换

         OSPF Process 1 with Router ID 5.5.5.5
                 Link State Database

-----------------------


1.5.4 no-import-route //ABR如果做了引入外部路由,由于NSSA内部设备可以通过默认路由访问外部,我们可以不需要该路由

<SW3>dis ip rou pro ospf

Route Flags: R - relay, D - download to fib
Public routing table : OSPF
         Destinations : 2        Routes : 3        
OSPF routing table status : <Active>
         Destinations : 2        Routes : 3
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   OSPF    10   2           D   10.1.15.5       Vlanif30
                    OSPF    10   2           D   10.1.15.1       Vlanif30
      100.1.1.1/32  O_NSSA  150  1           D   10.1.15.1       Vlanif30 //默认进入NSSA




[R1-ospf-1-area-0.0.0.15]nssa translator-always no-summary no-import-route 


<SW3>dis ip rou pro ospf

Route Flags: R - relay, D - download to fib
Public routing table : OSPF
         Destinations : 1        Routes : 2        
OSPF routing table status : <Active>
         Destinations : 1        Routes : 2
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   OSPF    10   2           D   10.1.15.5       Vlanif30
                    OSPF    10   2           D   10.1.15.1       Vlanif30

1.5.5 ABR转换为5类LSA后转发地址为全0

[R1-ospf-1-area-0.0.0.15]nssa translator-always no-summary no-import-route suppress-forwarding-address 


<R4>dis ospf lsdb ase 133.1.1.1

         OSPF Process 1 with Router ID 0.0.4.4
                 Link State Database

  Type      : External
  Ls id     : 133.1.1.1
  Adv rtr   : 0.0.0.1  
  Ls age    : 100 
  Len       : 36 
  Options   :  E  
  seq#      : 80000001 
  chksum    : 0x78b1
  Net mask  : 255.255.255.255 
  TOS 0  Metric: 1 
  E type    : 2
  Forwarding Address : 10.1.15.3 
  Tag       : 1 
  Priority  : Medium
  
  
  
<R4>dis ospf lsdb ase 133.1.1.1 //配置完毕之后的结果

         OSPF Process 1 with Router ID 0.0.4.4
                 Link State Database

  Type      : External
  Ls id     : 133.1.1.1
  Adv rtr   : 0.0.0.1  
  Ls age    : 54 
  Len       : 36 
  Options   :  E  
  seq#      : 80000002 
  chksum    : 0xe38
  Net mask  : 255.255.255.255 
  TOS 0  Metric: 1 
  E type    : 2
  Forwarding Address : 0.0.0.0 
  Tag       : 1 

  Priority  : Medium

1.5.6 default-route-advertise ASBR上完成

  • ASBR上完成,不要在ABR上实施。还有一个条件,设备上存在其他形式的默认路由
[SW3]ip route-static 0.0.0.0 0.0.0.0 NULL 0
[SW3-ospf-1-area-0.0.0.15]nssa default-route-advertise 


[R5]dis ip rou pro ospf

Route Flags: R - relay, D - download to fib
Public routing table : OSPF
         Destinations : 12       Routes : 13       
OSPF routing table status : <Active>
         Destinations : 11       Routes : 12
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   O_NSSA  150  1           D   10.1.15.1       GigabitEthernet0/0/2 //是拿掉R1的no-summary参数得到的NSSA的ABR产生的默认路由
                    O_NSSA  150  1           D   10.1.15.3       GigabitEthernet0/0/2 //是SW3上实施通告默认路由后产生的OSPF的7类的默认路由

1.6 LSA总结

LSA,计算路由的材料,不是最终的路由

划分区域后----->LSA的分类

1、2类:只在一个城市小打小闹

3类:把生意做到了其他省份

5类LSA:到全世界(除了一些特殊国家)

4类LSA:中间人或者国外的代理商

7类LSA:特殊国家

技术图片

技术图片

作业:

1.在R1完成引入路由,但是不允许这些外部路由进入NSSA区域

2.SW3上引入外部路由,R1上完成7类转5类LSA的操作

8. OSPF的NSSA详解

标签:操作   tag   ati   nal   ctrl   bytes   abi   address   flags   

原文地址:https://www.cnblogs.com/j-chao/p/13285651.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!