【华为】OSPF协议Stub和NSSA区域

实验拓扑

实验任务

  • 设备IP地址配置。
  • 按照规划配置 OSPF区域。
  • 检查OSPF配置结果,检查OSPF邻居关系状态,检查OSFP路由表。
  • 在R1、R4上将外部路由引入到OSPF中。
  • 配置区域3为Stub区域,观察区域3内OSPF路由表、LSDB的变化。
  • 配置区域1为NSSA区域,观察区域1内OSPF路由表、LSDB的变化。
  • 查看R4的OSPF路由器身份,在 R4上观察Type-7 LSA向Type-5 LSA的转换。

实验步骤

接口配置和OSPF区域配置

以R2为例:

java 复制代码
interface GigabitEthernet0/0/0                                                                                                      
 ip address 10.1.12.2 255.255.255.252                                                                                               
 ospf network-type p2p                                                                                                              
#                                                                                                                                   
interface GigabitEthernet0/0/1                                                                                                      
 ip address 10.1.23.1 255.255.255.252                                                                                               
 ospf network-type p2p                                                                                                              
#                                                                                                                                   
interface GigabitEthernet0/0/2                                                                                                      
 ip address 10.1.25.1 255.255.255.252                                                                                               
 ospf network-type p2p                                                                                                                                                                                                                                  
#                                                                                                                                   
interface LoopBack0                                                                                                                 
 ip address 10.0.2.2 255.255.255.255                                                                                                
#                                                                                                                                   
ospf 1 router-id 10.0.2.2                                                                                                           
 area 0.0.0.0                                                                                                                       
  network 10.0.2.2 0.0.0.0                                                                                                          
  network 10.1.23.1 0.0.0.0                                                                                                         
 area 0.0.0.2                                                                                                                       
  network 10.1.12.2 0.0.0.0                                                                                                         
 area 0.0.0.3                                                                                                                       
  network 10.1.25.1 0.0.0.0 

检查邻居关系和路由

java 复制代码
<R2>display ospf peer brief                                                                                                         
                                                                                                                                    
         OSPF Process 1 with Router ID 10.0.2.2                                                                                     
                  Peer Statistic Information                                                                                        
 ----------------------------------------------------------------------------                                                       
 Area Id          Interface                        Neighbor id      State                                                           
 0.0.0.0          GigabitEthernet0/0/1             10.0.3.3         Full                                                            
 0.0.0.2          GigabitEthernet0/0/0             10.0.1.1         Full                                                            
 0.0.0.3          GigabitEthernet0/0/2             10.0.5.5         Full                                                            
 ----------------------------------------------------------------------------  

<R2>display ospf routing                                                                                                            
                                                                                                                                    
         OSPF Process 1 with Router ID 10.0.2.2                                                                                     
                  Routing Tables                                                                                                    
                                                                                                                                    
 Routing for Network                                                                                                                
 Destination        Cost  Type       NextHop         AdvRouter       Area                                                           
 10.0.2.2/32        0     Stub       10.0.2.2        10.0.2.2        0.0.0.0                                                        
 10.1.12.0/30       1     Stub       10.1.12.2       10.0.2.2        0.0.0.2                                                        
 10.1.23.0/30       1     Stub       10.1.23.1       10.0.2.2        0.0.0.0                                                        
 10.1.25.0/30       1     Stub       10.1.25.1       10.0.2.2        0.0.0.3                                                        
 10.0.3.3/32        1     Stub       10.1.23.2       10.0.3.3        0.0.0.0                                                        
 10.0.5.5/32        1     Stub       10.1.25.2       10.0.5.5        0.0.0.3                                                        
 10.1.34.0/30       2     Inter-area 10.1.23.2       10.0.3.3        0.0.0.0    

在R1、R4上将外部路由引入到OSPF中

java 复制代码
ospf 1 router-id 10.0.4.4                                                                                                           
 import-route direct    

在R5观察路由表和LSDB:

java 复制代码
<R5>display ospf routing                                                                                                            
                                                                                                                                    
         OSPF Process 1 with Router ID 10.0.5.5                                                                                     
                  Routing Tables                                                                                                    
                                                                                                                                    
 Routing for Network                                                                                                                
 Destination        Cost  Type       NextHop         AdvRouter       Area                                                           
 10.0.5.5/32        0     Stub       10.0.5.5        10.0.5.5        0.0.0.3                                                        
 10.1.25.0/30       1     Stub       10.1.25.2       10.0.5.5        0.0.0.3                                                        
 10.0.2.2/32        1     Inter-area 10.1.25.1       10.0.2.2        0.0.0.3                                                        
 10.0.3.3/32        2     Inter-area 10.1.25.1       10.0.2.2        0.0.0.3                                                        
 10.1.12.0/30       2     Inter-area 10.1.25.1       10.0.2.2        0.0.0.3                                                        
 10.1.23.0/30       2     Inter-area 10.1.25.1       10.0.2.2        0.0.0.3                                                        
 10.1.34.0/30       3     Inter-area 10.1.25.1       10.0.2.2        0.0.0.3                                                        
                                                                                                                                    
 Routing for ASEs                                                                                                                   
 Destination        Cost      Type       Tag         NextHop         AdvRouter                                                      
 10.0.1.1/32        1         Type2      1           10.1.25.1       10.0.1.1                                                       
 10.0.4.4/32        1         Type2      1           10.1.25.1       10.0.4.4                                                       
                                                                                                                                    
 Total Nets: 9                                                                                                                      
 Intra Area: 2  Inter Area: 5  ASE: 2  NSSA: 0 

<R5>display ospf lsdb                                                                                                               
                                                                                                                                    
         OSPF Process 1 with Router ID 10.0.5.5                                                                                     
                 Link State Database                                                                                                
                                                                                                                                    
                         Area: 0.0.0.3                                                                                              
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric                                                          
 Router    10.0.5.5        10.0.5.5           643  60    80000005       0                                                           
 Router    10.0.2.2        10.0.2.2           644  48    80000002       1                                                           
 Sum-Net   10.1.23.0       10.0.2.2           902  28    80000001       1                                                           
 Sum-Net   10.1.34.0       10.0.2.2           787  28    80000001       2                                                           
 Sum-Net   10.1.12.0       10.0.2.2           902  28    80000001       1                                                           
 Sum-Net   10.0.3.3        10.0.2.2           796  28    80000001       1                                                           
 Sum-Net   10.0.2.2        10.0.2.2           902  28    80000001       0                                                           
 Sum-Asbr  10.0.4.4        10.0.2.2           734  28    80000001       2                                                           
 Sum-Asbr  10.0.1.1        10.0.2.2           902  28    80000001       1                                                           
                                                                                                                                    
                                                                                                                                    
                 AS External Database                                                                                               
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric                                                          
 External  10.0.4.4        10.0.4.4           736  36    80000001       1                                                           
 External  10.0.1.1        10.0.1.1          1024  36    80000001       1                                                           
 External  10.1.12.0       10.0.1.1          1024  36    80000001       1                                                           
 External  10.1.34.0       10.0.4.4           736  36    80000001       1 

配置Stub区域

在R2和R5配置区域3为Stub区域,以R5为例:

java 复制代码
ospf 1 router-id 10.0.5.5                                                                                                           
 area 0.0.0.3                                                                                                                       
  network 10.0.5.5 0.0.0.0                                                                                                          
  network 10.1.25.2 0.0.0.0                                                                                                         
  stub 

观察R5的路由表和LSDB

java 复制代码
<R5>display ospf routing                                                                                                            
                                                                                                                                    
         OSPF Process 1 with Router ID 10.0.5.5                                                                                     
                  Routing Tables                                                                                                    
                                                                                                                                    
 Routing for Network                                                                                                                
 Destination        Cost  Type       NextHop         AdvRouter       Area                                                           
 10.0.5.5/32        0     Stub       10.0.5.5        10.0.5.5        0.0.0.3                                                        
 10.1.25.0/30       1     Stub       10.1.25.2       10.0.5.5        0.0.0.3                                                        
 0.0.0.0/0          2     Inter-area 10.1.25.1       10.0.2.2        0.0.0.3                                                        
 10.0.2.2/32        1     Inter-area 10.1.25.1       10.0.2.2        0.0.0.3                                                        
 10.0.3.3/32        2     Inter-area 10.1.25.1       10.0.2.2        0.0.0.3                                                        
 10.1.12.0/30       2     Inter-area 10.1.25.1       10.0.2.2        0.0.0.3                                                        
 10.1.23.0/30       2     Inter-area 10.1.25.1       10.0.2.2        0.0.0.3                                                        
 10.1.34.0/30       3     Inter-area 10.1.25.1       10.0.2.2        0.0.0.3                                                        
                                                                                                                                    
 Total Nets: 8                                                                                                                      
 Intra Area: 2  Inter Area: 6  ASE: 0  NSSA: 0  

<R5>display ospf lsdb                                                                                                               
                                                                                                                                    
         OSPF Process 1 with Router ID 10.0.5.5                                                                                     
                 Link State Database                                                                                                
                                                                                                                                    
                         Area: 0.0.0.3                                                                                              
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric                                                          
 Router    10.0.5.5        10.0.5.5            85  60    80000003       0                                                           
 Router    10.0.2.2        10.0.2.2            86  48    80000003       1                                                           
 Sum-Net   0.0.0.0         10.0.2.2           106  28    80000001       1                                                           
 Sum-Net   10.1.23.0       10.0.2.2           106  28    80000001       1                                                           
 Sum-Net   10.1.34.0       10.0.2.2           106  28    80000001       2                                                           
 Sum-Net   10.1.12.0       10.0.2.2           106  28    80000001       1                                                           
 Sum-Net   10.0.3.3        10.0.2.2           106  28    80000001       1                                                           
 Sum-Net   10.0.2.2        10.0.2.2           106  28    80000001       0 

此时,R5路由器不存在4/5类的LSA,由ABR(R2)产生一条三类LSA泛洪默认路由,指向ABR本身。

同时在R3区域内也不能引入外部路由,引入不生效。

java 复制代码
ip route-static 0.0.0.0 0.0.0.0 LoopBack 0

ospf 1 router-id 10.0.5.5                                                                                                           
 import-route static

配置NSSA区域

在R3和R4区域1配置NSSA区域

java 复制代码
ospf 1 router-id 10.0.4.4                                                                                                           
 import-route direct                                                                                                                
 area 0.0.0.1                                                                                                                       
  network 10.1.34.2 0.0.0.0                                                                                                         
  nssa                                                                                                                              
#      

在R4观察路由表和LSDB

java 复制代码
<R4>display ospf lsdb                                                                                                               
                                                                                                                                    
         OSPF Process 1 with Router ID 10.0.4.4                                                                                     
                 Link State Database                                                                                                
                                                                                                                                    
                         Area: 0.0.0.1                                                                                              
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric                                                          
 Router    10.0.3.3        10.0.3.3            17  36    80000004       1                                                           
 Router    10.0.4.4        10.0.4.4            16  36    80000005       1                                                           
 Network   10.1.34.2       10.0.4.4            17  32    80000001       0                                                           
 Sum-Net   10.1.23.0       10.0.3.3            57  28    80000001       1                                                           
 Sum-Net   10.1.25.0       10.0.3.3            57  28    80000001       2                                                           
 Sum-Net   10.1.12.0       10.0.3.3            57  28    80000001       2                                                           
 Sum-Net   10.0.3.3        10.0.3.3            57  28    80000001       0                                                           
 Sum-Net   10.0.2.2        10.0.3.3            57  28    80000001       1                                                           
 Sum-Net   10.0.5.5        10.0.3.3            57  28    80000001       2                                                           
 NSSA      10.0.4.4        10.0.4.4            76  36    80000001       1                                                           
 NSSA      10.1.34.0       10.0.4.4            76  36    80000002       1                                                           
 NSSA      0.0.0.0         10.0.3.3            57  36    80000001       1 

<R4>display ospf lsdb                                                                                                               
                                                                                                                                    
         OSPF Process 1 with Router ID 10.0.4.4                                                                                     
                 Link State Database                                                                                                
                                                                                                                                    
                         Area: 0.0.0.1                                                                                              
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric                                                          
 Router    10.0.3.3        10.0.3.3            73  36    80000004       1                                                           
 Router    10.0.4.4        10.0.4.4            72  36    80000005       1                                                           
 Network   10.1.34.2       10.0.4.4            73  32    80000001       0                                                           
 Sum-Net   10.1.23.0       10.0.3.3           113  28    80000001       1                                                           
 Sum-Net   10.1.25.0       10.0.3.3           113  28    80000001       2                                                           
 Sum-Net   10.1.12.0       10.0.3.3           113  28    80000001       2                                                           
 Sum-Net   10.0.3.3        10.0.3.3           113  28    80000001       0                                                           
 Sum-Net   10.0.2.2        10.0.3.3           113  28    80000001       1                                                           
 Sum-Net   10.0.5.5        10.0.3.3           113  28    80000001       2                                                           
 NSSA      10.0.4.4        10.0.4.4           132  36    80000001       1                                                           
 NSSA      10.1.34.0       10.0.4.4           132  36    80000002       1                                                           
 NSSA      0.0.0.0         10.0.3.3           113  36    80000001       1  

在NSSA区域内不允许其他区域的外部路由进入,但是NSSA区域可以引入外部路由,并且以Type-7 LSA通告给本区域。在ABR上会向区域内下发一条由Type-7描述的默认路由。

在R3上观察LSA

java 复制代码
<R3>display ospf lsdb                                                                                                               
                                                                                                                                    
         OSPF Process 1 with Router ID 10.0.3.3                                                                                     
                 Link State Database                                                                                                
                                                                                                                                    
                         Area: 0.0.0.0                                                                                              
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric                                                          
 Router    10.0.3.3        10.0.3.3           676  60    80000005       0                                                           
 Router    10.0.2.2        10.0.2.2           129  60    80000006       0                                                           
 Sum-Net   10.1.25.0       10.0.2.2          1075  28    80000002       1                                                           
 Sum-Net   10.1.34.0       10.0.3.3           676  28    80000002       1                                                           
 Sum-Net   10.1.12.0       10.0.2.2           245  28    80000002       1                                                           
 Sum-Net   10.0.5.5        10.0.2.2          1055  28    80000001       1                                                           
 Sum-Asbr  10.0.1.1        10.0.2.2           241  28    80000002       1                                                           
                                                                                                                                    
                         Area: 0.0.0.1                                                                                              
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric                                                          
 Router    10.0.3.3        10.0.3.3           636  36    80000004       1                                                           
 Router    10.0.4.4        10.0.4.4           637  36    80000005       1                                                           
 Network   10.1.34.2       10.0.4.4           638  32    80000001       0                                                           
 Sum-Net   10.1.23.0       10.0.3.3           676  28    80000001       1                                                           
 Sum-Net   10.1.25.0       10.0.3.3           676  28    80000001       2                                                           
 Sum-Net   10.1.12.0       10.0.3.3           676  28    80000001       2                                                           
 Sum-Net   10.0.3.3        10.0.3.3           676  28    80000001       0                                                           
 Sum-Net   10.0.2.2        10.0.3.3           676  28    80000001       1                                                           
 Sum-Net   10.0.5.5        10.0.3.3           676  28    80000001       2                                                           
 NSSA      0.0.0.0         10.0.3.3           676  36    80000001       1                                                           
 NSSA      10.0.4.4        10.0.4.4           697  36    80000001       1                                                           
 NSSA      10.1.34.0       10.0.4.4           697  36    80000002       1 

                 AS External Database                                                                                               
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric                                                          
 External  10.0.4.4        10.0.3.3           636  36    80000001       1                                                           
 External  10.0.4.4        10.0.4.4          1867  36    80000001       1                                                           
 External  10.0.1.1        10.0.1.1           357  36    80000002       1                                                           
 External  10.1.12.0       10.0.1.1           357  36    80000002       1                                                           
 External  10.1.34.0       10.0.4.4          1867  36    80000001       1     

在R3上将Type-7类LSA转换为Type-5类LSA通告给其他区域。

在R3上观察OSPF摘要信息,可以看到此时R3的身份为AREA AS NSSA,分别代表路由器为ABR、ASBR以及存在接口属于NSSA。

java 复制代码
<R3>display ospf brief                                                                                                              
                                                                                                                                    
         OSPF Process 1 with Router ID 10.0.3.3                                                                                     
                 OSPF Protocol Information                                                                                          
                                                                                                                                    
 RouterID: 10.0.3.3         Border Router:  AREA  AS  NSSA                                                                          
 Multi-VPN-Instance is not enabled                                                                                                  
 Global DS-TE Mode: Non-Standard IETF Mode                                                                                          
 Graceful-restart capability: disabled                                                                                              
 Helper support capability  : not configured                                                                                        
 Applications Supported: MPLS Traffic-Engineering                                                                                   
 Spf-schedule-interval: max 10000ms, start 500ms, hold 1000ms                                                                       
 Default ASE parameters: Metric: 1 Tag: 1 Type: 2                                                                                   
 Route Preference: 10                                                                                                               
 ASE Route Preference: 150                                                                                                          
 SPF Computation Count: 15                                                                                                          
 RFC 1583 Compatible                                                                                                                
 Retransmission limitation is disabled                                                                                              
 Area Count: 2   Nssa Area Count: 1                                                                                                 
 ExChange/Loading Neighbors: 0                                                                                                      
 Process total up interface count: 3                                                                                                
 Process valid up interface count: 2                                                                                                
                                                                                                                                    
 Area: 0.0.0.0          (MPLS TE not enabled)                                                                                       
 Authtype: None   Area flag: Normal                                                                                                 
 SPF scheduled Count: 15                                                                                                            
 ExChange/Loading Neighbors: 0                                                                                                      
 Router ID conflict state: Normal                                                                                                   
 Area interface up count: 2                                                                                                         
                                                                                                                                    
 Interface: 10.0.3.3 (LoopBack0)                                                                                                    
 Cost: 0       State: P-2-P     Type: P2P       MTU: 1500                                                                           
 Timers: Hello 10 , Dead 40 , Poll  120 , Retransmit 5 , Transmit Delay 1                                                           
                                                                                                                                    
 Interface: 10.1.23.2 (GigabitEthernet0/0/0) --> 10.1.23.1    
相关推荐
无限码力1 小时前
华为非AI方向笔试真题 - 任意矩形图案解锁路径验证
华为·华为非ai方向笔试真题·华为笔试真题·华为最新笔试真题
●VON2 小时前
鸿蒙Flutter实战:异步回调mounted检查安全实践
flutter·华为·harmonyos·鸿蒙
●VON2 小时前
鸿蒙Flutter实战:MethodChannel桥接获取OHOS文件目录
flutter·华为·harmonyos·鸿蒙
HwJack202 小时前
HarmonyOS APP开发中Native 层崩溃信号全集与生存指南
华为·harmonyos
搜移IT科技3 小时前
华为发布 “韬定律”,半导体换道超车引市场重估
华为
co_wait3 小时前
【华为】OSPF邻接关系和LSA
华为·智能路由器
李二。3 小时前
鸿蒙原生ArkTS-太空探索新闻AI
人工智能·华为·harmonyos
慧海灵舟3 小时前
鸿蒙南向开发教程 Day 7:互斥锁(Mutex)
华为·harmonyos
●VON3 小时前
鸿蒙Flutter实战:IndexedStack保持Tab页面状态
flutter·华为·harmonyos·鸿蒙