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

假装网络工程师12——ospf中的特殊区域及6,7类lsa详解

时间:2020-02-10 10:15:10      阅读:88      评论:0      收藏:0      [点我收藏+]

标签:拓扑   The   如何   方式   观察   http   介绍   成本   ansi   

一、背景介绍

假设有一个大型企业,各省市都有分公司,总路由与运营网络之间跑bgp,总路由与各省路由器在area 0,每个省的不同地市处在不同的area, 其网络拓扑如下所示,:
技术图片
以area 1中的R5为例,当配置完ospf之后,R5上除了本区域的1,2类lsa外,还会通过3类lsa学习到area 2的路由,然后还会通过4,5类lsa学习到外部网络的路由及asbr条目,这样R5的路由表就会变得异常庞大,而路由表是存放在路由器的内存中,大量的lsa除了会造成带宽浪费,也会造成本地设备性能下降,基于此,要进行路由条目的优化

二、stub和totally stub区域

1.stub区域

仍是以area 1上的R5为例,仔细观察会发现R5无论是访问外部网络或者是访问其他地市的网络都会通过R3或者R4这两个汇聚层的路由器,作为接入层路由器的R5本身设备性能肯定不如汇聚层设备,另外R5只需要将访问外网的默认路由指向R3,R4即可,没必要保存外网的路由条目,基于此,将area 1配置成stub区域,就能使abr过滤掉4,5类lsa,并由abr向area 1下发一条3类lsa的默认路由,达到简化路由条目的目的

2.totally stub区域

尽管通过stub区域已经过滤掉了4,5类lsa,但不同地市之间的路由(area 1,area 2)还是能相互学习到,为了进一步精简R5的路由条目,让他不用学到其他area的路由信息,此时就可以采用totally stub区域,其作用是让abr除了4,5类lsa外进一步将3类lsa也过滤掉,这样abr只对本区域下发一条默认路由(3类lsa),不同area之间不会相互学习,以此达到精简条目的目的

3.小结

  • stub区域的abr过滤掉4,5类lsa,并下发一条3类lsa的默认路由,即5类转3类lsa
  • totally stub区域是在stub区域的基础上让abr进一步过滤掉area之间的3类lsa,只保留一条3类lsa的默认路由
  • stub区域或者totally stub区域都不允许进行路由再发布

三、nssa区域和totally nssa区域

1.nssa区域

仍以上图为例,但在有的时候,不管是出于什么需求,就是需要area 1发布路由,同时又想实现向stub一样精简路由条目的目的,此时就需要将area 1设置为nssa区域。nssa全称not-so-stub area,它的具备了stub区域的功能让abr过滤掉4,5类lsa外还允许该区域进行路由重发布,发布的路由以7类lsa的方式在nssa区域中泛洪,而7类lsa是不能够在nssa以外区域泛洪,为了让其他区域学习到这条外部路由,nssa区域的abr会将7类lsa转变成5类lsa注入到area 0中,此时就可以在所有as域内泛洪

2.totally nssa区域

类似于totally stub,totally nssa也是在nssa基础上让arb过滤掉其他区域的3类lsa,此处不再赘述

3.小结

  • nssa区域的abr过滤掉4,5类lsa,并下发一条7类lsa的默认路由,即5类转7类lsa,且7类lsa不允许在除nssa外的其他区域泛洪
  • totally stub区域是在stub区域的基础上让abr进一步过滤掉area之间的3类lsa,除了默认路由的7类lsa外,如果是菊厂的设备,他还会下发一条默认路由的3类lsa
  • nssa区域或者totally nssa区域都允许进行路由再发布

四、stub和totally stub实验

1.stub区域

为模拟末节网络,拓扑及信息如下图所示:
技术图片
假设R1的lo0接口为外部路由,完成基础配置后能看看此时R3上同时有1,2,3,4,5类lsa

<R3>display ospf lsdb 

     OSPF Process 1 with Router ID 3.3.3.3
         Link State Database 

                 Area: 0.0.0.1
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    2.2.2.2         2.2.2.2           1054  36    80000005       1
 Router    3.3.3.3         3.3.3.3           1045  48    80000006       1
 Network   23.0.0.3        3.3.3.3           1045  32    80000003       0
 Sum-Net   12.0.0.0        2.2.2.2           1116  28    80000002       1
 Sum-Asbr  1.1.1.1         2.2.2.2            256  28    80000001       1

         AS External Database
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 External  12.0.0.0        1.1.1.1            257  36    80000001       1
 External  1.1.1.0         1.1.1.1            257  36    80000001       1

要将一个区域配置为stub时,需要在这个内所有的路由器上进行配置

[R2]ospf 1    
[R2-ospf-1]area 1  
[R2-ospf-1-area-0.0.0.1]stub  

[R3]ospf 1
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]stub 

配置后再到R3上看lsdb会发现4,5类lsa已经由abr(R2)进行了阻挡,同时R2下发了一条3类的默认路由

<R3>display ospf lsdb 

     OSPF Process 1 with Router ID 3.3.3.3
         Link State Database 

                 Area: 0.0.0.1
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    2.2.2.2         2.2.2.2              8  36    80000004       1
 Router    3.3.3.3         3.3.3.3              7  48    80000005       1
 Network   23.0.0.3        3.3.3.3              7  32    80000001       0
 Sum-Net   0.0.0.0         2.2.2.2             54  28    80000001       1
 Sum-Net   12.0.0.0        2.2.2.2             54  28    80000001       1

2.totally stub区域

配置成为totally stub时,只需要在abr的stub 命令后面加上no-summary选项,area内其他路由器只需要设置为stub区域,原因是只有abr能过滤lsa信息

[R2-ospf-1-area-0.0.0.1]stub no-summary 

此时再看R3上的lsdb会发现只剩下一条默认路由的3类lsa,area 0中12.0.0.0/24的3类lsa也被abr阻挡掉了

<R3>display ospf lsdb 

     OSPF Process 1 with Router ID 3.3.3.3
         Link State Database 

                 Area: 0.0.0.1
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    2.2.2.2         2.2.2.2             14  36    80000009       1
 Router    3.3.3.3         3.3.3.3             11  48    8000000E       1
 Network   23.0.0.3        3.3.3.3             11  32    80000002       0
 Sum-Net   0.0.0.0         2.2.2.2             15  28    80000006       1

五、nssa和totally nssa实验

1.nssa区域

拓扑及信息如下图所示:
技术图片
其中R1与R4的lo0端口模拟外部网络,先将R4的lo0端口用import-route direct引入,此时查看R1的lsdb,能看到1,2,3,4,5类lsa都存在

<R1>display ospf lsdb 

     OSPF Process 1 with Router ID 1.1.1.1
         Link State Database 

                 Area: 0.0.0.1
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    2.2.2.2         2.2.2.2            831  36    80000007       1
 Router    1.1.1.1         1.1.1.1            832  36    80000007       1
 Network   12.0.0.2        2.2.2.2            831  32    80000004       0
 Sum-Net   23.0.0.0        2.2.2.2            872  28    80000003       1
 Sum-Net   34.0.0.0        2.2.2.2            872  28    80000003       2
 Sum-Asbr  4.4.4.4         2.2.2.2            872  28    80000003       2

         AS External Database
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 External  4.4.4.0         4.4.4.4            941  36    80000003       1
 External  34.0.0.0        4.4.4.4            941  36    80000003       1

此时,将area 1配置为nssa区域

[R1]ospf 1
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]nssa  

[R2]ospf 1
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]nssa 

再去R1上查看lsdb,会发现abr(R2)已经过滤掉了4,5类lsa,并向area 1中下发了一条7类lsa的默认路由

 [R1]display ospf lsdb 

     OSPF Process 1 with Router ID 1.1.1.1
         Link State Database 

                 Area: 0.0.0.1
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    2.2.2.2         2.2.2.2             70  36    80000004       1
 Router    1.1.1.1         1.1.1.1             69  36    80000004       1
 Network   12.0.0.1        1.1.1.1             70  32    80000002       0
 Sum-Net   23.0.0.0        2.2.2.2             80  28    80000001       1
 Sum-Net   34.0.0.0        2.2.2.2             80  28    80000001       2
 NSSA      0.0.0.0         2.2.2.2             80  36    80000001       1

 <R1>display ospf routing 

     OSPF Process 1 with Router ID 1.1.1.1
          Routing Tables 

 Routing for Network 
 Destination        Cost  Type       NextHop         AdvRouter       Area
 12.0.0.0/24        1     Transit    12.0.0.1        1.1.1.1         0.0.0.1
 23.0.0.0/24        2     Inter-area 12.0.0.2        2.2.2.2         0.0.0.1
 34.0.0.0/24        3     Inter-area 12.0.0.2        2.2.2.2         0.0.0.1

 Routing for NSSAs
 Destination        Cost      Type       Tag         NextHop         AdvRouter
 0.0.0.0/0          1         Type2      1           12.0.0.2        2.2.2.2

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

但在abr(R2)的area 0上,并不能找到7类lsa,说明7类lsa不能离开nssa区域

 <R2>display ospf lsdb 

     OSPF Process 1 with Router ID 2.2.2.2
         Link State Database 

                 Area: 0.0.0.0
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    2.2.2.2         2.2.2.2            489  36    8000000A       1
 Router    3.3.3.3         3.3.3.3            657  36    80000009       1
 Network   23.0.0.3        3.3.3.3            657  32    80000006       0
 Sum-Net   34.0.0.0        3.3.3.3            683  28    80000005       1
 Sum-Net   12.0.0.0        2.2.2.2            489  28    80000007       1
 Sum-Asbr  4.4.4.4         3.3.3.3            604  28    80000004       1

                 Area: 0.0.0.1
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    2.2.2.2         2.2.2.2            479  36    80000004       1
 Router    1.1.1.1         1.1.1.1            480  36    80000004       1
 Network   12.0.0.1        1.1.1.1            481  32    80000002       0
 Sum-Net   23.0.0.0        2.2.2.2            489  28    80000001       1
 Sum-Net   34.0.0.0        2.2.2.2            489  28    80000001       2
 NSSA      0.0.0.0         2.2.2.2            489  36    80000001       1

         AS External Database
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 External  4.4.4.0         4.4.4.4            606  36    80000004       1
 External  34.0.0.0        4.4.4.4            606  36    80000004       1

再将R1上的lo0接口引入,此时再查看R1的lsdb,会发现多了2条nssa记录,其作用分别是:对内将外部的1.1.1.0/24的网段进行宣告,对外将内部的12.0.0.0/24网段进行宣告

 [R1]display ospf lsdb 

     OSPF Process 1 with Router ID 1.1.1.1
         Link State Database 

                 Area: 0.0.0.1
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    2.2.2.2         2.2.2.2           1012  36    80000004       1
 Router    1.1.1.1         1.1.1.1             11  36    80000005       1
 Network   12.0.0.1        1.1.1.1           1012  32    80000002       0
 Sum-Net   23.0.0.0        2.2.2.2           1022  28    80000001       1
 Sum-Net   34.0.0.0        2.2.2.2           1022  28    80000001       2
 NSSA      12.0.0.0        1.1.1.1             11  36    80000001       1
 NSSA      1.1.1.0         1.1.1.1             11  36    80000001       1
 NSSA      0.0.0.0         2.2.2.2           1022  36    80000001       1

但之前说过,7类lsa只能在nssa区域中泛洪,他是如何发送给其他区域,此时再看abr(R2)的lsdb,会发现area 1中宣告1.1.1.0/24网段的7类lsa在abr上变成了一个5类lsa,以此在整个as中泛洪

 <R2>display ospf lsdb 

     OSPF Process 1 with Router ID 2.2.2.2
         Link State Database 

                 Area: 0.0.0.0
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    2.2.2.2         2.2.2.2           1070  36    8000000A       1
 Router    3.3.3.3         3.3.3.3           1238  36    80000009       1
 Network   23.0.0.3        3.3.3.3           1238  32    80000006       0
 Sum-Net   34.0.0.0        3.3.3.3           1264  28    80000005       1
 Sum-Net   12.0.0.0        2.2.2.2           1070  28    80000007       1
 Sum-Asbr  4.4.4.4         3.3.3.3           1185  28    80000004       1

                 Area: 0.0.0.1
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    2.2.2.2         2.2.2.2           1060  36    80000004       1
 Router    1.1.1.1         1.1.1.1             61  36    80000005       1
 Network   12.0.0.1        1.1.1.1           1062  32    80000002       0
 Sum-Net   23.0.0.0        2.2.2.2           1070  28    80000001       1
 Sum-Net   34.0.0.0        2.2.2.2           1070  28    80000001       2
 NSSA      0.0.0.0         2.2.2.2           1070  36    80000001       1
 NSSA      12.0.0.0        1.1.1.1             61  36    80000001       1
 NSSA      1.1.1.0         1.1.1.1             61  36    80000001       1

         AS External Database
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 External  1.1.1.0         2.2.2.2             60  36    80000001       1
 External  4.4.4.0         4.4.4.4           1187  36    80000004       1
 External  34.0.0.0        4.4.4.4           1187  36    80000004       1

2.totally nssa区域

类似于stub,也在area 1的abr上添加no-summary选项,该area内其他路由器设置为nssa区域

 [R2-ospf-1-area-0.0.0.1]nssa no-summary 

此时再查看R1的lsdb会发现,除了原有7类lsa的默认路由外,虽然其他area的3类lsa被abr过滤掉了,但abr此时还会向area 1下发一个默认路由的3类lsa,只有菊厂设备有这种特性

 [R1]display ospf lsdb 

     OSPF Process 1 with Router ID 1.1.1.1
         Link State Database 

                 Area: 0.0.0.1
 Type      LinkState ID    AdvRouter          Age  Len   Sequence   Metric
 Router    2.2.2.2         2.2.2.2             13  36    80000007       1
 Router    1.1.1.1         1.1.1.1              4  36    8000000B       1
 Network   12.0.0.1        1.1.1.1              4  32    80000002       0
 Sum-Net   0.0.0.0         2.2.2.2             24  28    80000001       1
 NSSA      12.0.0.0        1.1.1.1            169  36    80000002       1
 NSSA      1.1.1.0         1.1.1.1            169  36    80000002       1
 NSSA      0.0.0.0         2.2.2.2             14  36    80000003       1

六、总结与6类lsa

总结一下ospf中6种不同的lsa及其泛洪范围,可以总结为下表:
其中totally stub和totally nssa因为要下发一条3类lsa的默认路由,所以no是带星号

area/lsa类型 1&2 3 4 5 7
area 0 yes yes yes yes no
area N yes yes yes yes no
stub area yes yes no no no
totally stub yes no★ no no no
nssa area yes yes no no yes
totally nssa yes no★ no no yes

最后,说一下6类lsa,其全称group-membership-lsa,是在mospf中用于表示组播成员的,现在已基本被淘汰,不再做介绍

假装网络工程师12——ospf中的特殊区域及6,7类lsa详解

标签:拓扑   The   如何   方式   观察   http   介绍   成本   ansi   

原文地址:https://blog.51cto.com/arkling/2469888

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