7. OSPF外部路由和Stub区域

时间:2020-07-11
本文章向大家介绍7. OSPF外部路由和Stub区域,主要包括7. OSPF外部路由和Stub区域使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

1. 外部路由

5类LSA

通告者:ASBR

传输范围:整个OSPF domain(域)

内容和功能:描述外部路由

[R6-ospf-1]import-route direct 

<R1>dis ospf lsdb ase 6.6.6.6

         OSPF Process 1 with Router ID 0.0.0.1
                 Link State Database
  Type      : External   //LSA类型
  Ls id     : 6.6.6.6 	//路由,目标网段地址
  Adv rtr   : 0.0.0.6	 //产生五类LSA的ASBR的RID
  Ls age    : 109 
  Len       : 36 
  Options   :  E  
  seq#      : 80000001 
  chksum    : 0xc5ec
  Net mask  : 255.255.255.255 
  TOS 0  Metric: 1   //度量值默认为1,OSPF外部路由类型2,cost在域内不累加,类型1的cost在区域内累加
 
  E type    : 2        //类型为外部类型2,类型1的cost在区域内累加
  
  Forwarding Address : 0.0.0.0 //转发地址,即下一跳,如果是0.0.0.0的话就参照正常的路由(指向ASBR)
  
  Tag       : 1        //标识路由,通常用于路由策略,默认值为1(即使引入到其他OSPF进程依旧为1)
  Priority  : Medium

如果外部类型类型相同,cost相同,会优选较大的区域ID

外部路由可以负载

  • 当有多个最短路径时,且经过不同的区域,则优选从较大的区域ID 学习到的
[R1-ospf-1]import-route direct cost 10 tag 11 type 1


[R1-ospf-1]dis ip rou 1.1.1.1 ver

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

    Routing Table : Public
    Summary Count : 1

    Destination: 1.1.1.1/32
         Protocol: O_ASE            Process ID: 1
       Preference: 150                    Cost: 59
          NextHop: 10.1.35.5         Neighbour: 0.0.0.0
            State: Active Adv              Age: 00h00m15s
              Tag: 11                 Priority: medium
            Label: NULL                QoSInfo: 0x0
       IndirectID: 0x0              
     RelayNextHop: 0.0.0.0           Interface: GigabitEthernet0/0/0
         TunnelID: 0x0                   Flags:  D

4类LSA

通告者:ASBR所在区域的ABR

传输范围:除了ASBR所在区域,整个OSPF domain(域)

内容和功能:描述ASBR的RID

2. 次优外部路由的产生

ospf 1 router-id 5.5.5.5 
     peer 10.1.1.1
     area 0.0.0.0 
     area 0.0.0.15 
     area 0.0.0.35 
     area 0.0.0.56 
  		network 10.1.56.5 0.0.0.0 

R5、SW3、R6配置RIP协议,在SW3上RIP和OSPF互相引入
// 普通区域的转发地址

[R1]dis ospf lsdb ase 6.6.6.6

         OSPF Process 1 with Router ID 0.0.0.1
                 Link State Database

  Type      : External
  Ls id     : 6.6.6.6
  Adv rtr   : 10.1.15.3  
  Ls age    : 216 
  Len       : 36 
  Options   :  E  
  seq#      : 80000001 
  chksum    : 0x90eb
  Net mask  : 255.255.255.255 
  TOS 0  Metric: 1 
  E type    : 2
  Forwarding Address : 10.1.15.5 //非0,路由表的下一跳为转发地址,实现了转发的优化
  Tag       : 1 
  Priority  : Medium
  
  
// 某些监管下,一定要求流量从一个接入、再转出

interface Vlanif15
     ip address 10.1.15.3 255.255.255.0
     ospf network-type p2p
     ospf enable 1 area 0.0.0.15
 
 
[R1-GigabitEthernet0/0/1]dis ospf lsdb ase 6.6.6.6

         OSPF Process 1 with Router ID 0.0.0.1
                 Link State Database
  Type      : External
  Ls id     : 6.6.6.6
  Adv rtr   : 10.1.15.3  
  Ls age    : 68 
  Len       : 36 
  Options   :  E  
  seq#      : 80000002 
  chksum    : 0xa90
  Net mask  : 255.255.255.255 
  TOS 0  Metric: 1 
  E type    : 2
  Forwarding Address : 0.0.0.0   //转发地址为0.0.0.0
  Tag       : 1 
  Priority  : Medium
  
  
[R1-GigabitEthernet0/0/1]dis ip rou 6.6.6.6
Route Flags: R - relay, D - download to fib

Routing Table : Public
Summary Count : 1
Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

3.特殊区域

  • 更有效率的管理OSPF的LSA
  • 减少 LSA数量 和 路由表规模。

3.1 STUB区域(末节)

  • 骨干区域不能被配置成为Stub区域
  • 如果要将一个区域配置成Stub区域,则该区域种的所有路由器必须都要配置成Stub路由器
  • Stub 区域不能存在ASBR,自治系统域外部路由不能在本区域内传播
  • 虚连接不能穿越 Stub 区域建立
  ospf
 	area 56
 		stub

不能接收外部的LSA,E=0,取而代之用一条默认路由去访问外部网络

[SW3]dis cu conf ospf
#
ospf 1 router-id 13.13.13.13
  area 0.0.0.15
    stub
  
  
[SW3]dis ip routing-table protocol ospf

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

Public routing table : OSPF
         Destinations : 10       Routes : 14       

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

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        0.0.0.0/0   OSPF    10   2           D   10.1.15.1       Vlanif30
                    OSPF    10   2           D   10.1.15.5       Vlanif30 //area 15因为存在2个ABR,每个ABR都会产生默认路由的3类LSA(开销值默认为1),总的开销值为2



[R1]dis ospf lsdb summary 0.0.0.0

         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      : Sum-Net
  Ls id     : 0.0.0.0
  Adv rtr   : 0.0.0.1  
  Ls age    : 357 
  Len       : 28 
  Options   : None 
  seq#      : 80000001 
  chksum    : 0x8dcf
  Net mask  : 0.0.0.0
  Tos 0  metric: 1
  Priority  : Low

  Type      : Sum-Net
  Ls id     : 0.0.0.0
  Adv rtr   : 5.5.5.5  
  Ls age    : 351 
  Len       : 28 
  Options   : None 
  seq#      : 80000001 
  chksum    : 0xfc4d
  Net mask  : 0.0.0.0
  Tos 0  metric: 1
  Priority  : Low

3.2 完全Stub区域

  • 进一步减少3类LSA,仅仅剩余1、2类和ABR产生的默认路由的3类LSA
//在ABR设备上实施no-summary 

[R1]ospf
[R1-ospf-1]area 15
[R1-ospf-1-area-0.0.0.15]stub no-summary 
[R5]ospf
[R5-ospf-1]area 15
[R5-ospf-1-area-0.0.0.15]stub no-summary


[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



[SW3]dis ip routing-table protocol 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.1       Vlanif30
                    OSPF    10   2           D   10.1.15.5       Vlanif30

作业:

验证转发的地址两种场景0.0.0.0和非0

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