链路状态通告类型知识总结,LSA(Link State Advertisement)

一、相关解释,个人相关看法:

OSPF是通过LSA数据报文来联系关联路由器,交换信息,同步数据,在此基础上,各路由器拿到一手的各路由器接口状况信息,及时计算路由。平常配置OSPF,用不到它,配置完了OSPF,路由就就通了。但如果要做安全开发等更深层工作,掌握它才能下手操控。

一类,二类使用区域内路由构建;三类用于区域间路由构建;四类、五类用于外来路由;七类用于外部路由在特殊区域传输,公司初期异类网络合并常用。

用大白话讲:整个网络的目的是满足用户的使用,进行跨区,跨省,跨国访问,需要各个公司单位来协作网络的联网工作。用户的产生路由可以理解为LSA4, 5类完成,所以他需要全网穿越;公司间用LSA3类来实现,完成公司间网络路由工作;公司内部用LSA1, 2类来完成,完成公司内部网络建设工作。也就是说反过来理解才能看清研发这个技术的目的(任何实用技术的研发初期一般是需求驱动的,以目的为导引的),但构建得从公司内,公司间,到满足广大用户要求的顺序来做。

在此需要强调的是,不要到OSPF构建网络时,忘了网络的构建的目的。手动静态路由和自动路由构建的网络的目的一致,只是实现的手段不同。OSPF等只是由人为根据需求,用算法来实现,达到人为手工静态路由无法达到的规模和效率。所以要驾驭大型企业网,就必须掌握OSPF等技术,静态路由只能用于小规模网络。

二、OSPF(开放式的最短路径优先协议)是一个公有标准协议;

任何厂商的设备都可以支持;
该协议只能在 公司内部 使用,属于“内部网关协议”;
该协议在在不同的路由器之间传递的是“链路状态信息”,所以,称之为“链路状态 路由协议”。
该协议的报文封装在 IP 头部后面,属于 OSI 模型第三层,该协议在IP报文中的协议号为 89

该协议报文的发送方式是:组播

组播地址为:

224.0.0.5 , 表示所有的OSPF路由器
       例如,Hello报文的目标地址
224.0.0.6 , 表示所有的DR和BDR设备
       例如:DD报文的目标IP地址

关于这些OSPF概念,这个博客解释的很好,可以参考:https://blog.csdn.net/qq_45714272/article/details/108280724

ospf使用组播(224.0.0.5和224.0.0.6,占用大量的路由器硬件资源,从而节省人力资源,并提升人所不具备的效率)
收敛较快 (是高数中概念,在此我们可以理解为:网络由一种大范围的混乱状态下,在OSPF协议及相关配套软件的作用下,最终整个网络达到一种可接受可用的稳定状态)
以开销作为度量值
使用SPF算法可以有效避免环路(就是一种算法)
触发式更新update(30分钟发送定期更新,被称为链路泛洪,通过224.0.0.5组播来实现update更新状态,邻居收到了也以224.0.0.5进行回应状态确认)
区域设计使OSPF能支持更大规模的网络
通过LSA(链路状态)形式发布路由
不支持自动汇总,支持手动汇总
OSPF直接运行在IP协议之上,使用IP协议号89。

作用:

在路由器之间动态的学习路由条目,实现路由的传输和管理;

OSPF原理/工作过程:

1.建立邻居表
2.同步数据库
3.计算路由表

报文类型:

1.hello:  用于邻居的建立、维护和拆除;
2.DD: database description ,数据库 描述报文;描述数据库信息,确定主从关系
3.LSR:link state request ,链路状态请求;
4.LSU:link state update ,链路状态更新;
5.LSAck:link state Ack ,链路状态确认;

三、OSPF 是典型的链路状态路由协议,使用 LSA( Link State Advertisement ,链路状态通告)来装载和传输链路状态信息。

LSA 需要描述邻接路由器信息、直连链路信息、跨区域信息等,所以定义了多种类型的 LSA 。

        一类名词表示的RouterID;二类名字表示DR接口的IP地址;三类名字表示的是一个网段;四类名字是一个ASBR路由器的名字;

Type1 -->  Router :每个路由器都会在连接的每个区域产生1个,表示自身链路。只在区域内传输;

推测出路由和拓扑图,本区域内泛洪。

Type2 -->  Network : 只有DR可以产生,表示DR的管理范围。只在区域内传输   (DR  Designated Router,BDR Backup Designated Router)

DR产生,通告所有与DR有邻接关系的路由器,在本区域内泛洪。

Type3 -->  Sum-Net : 只有ABR可以产生,表示OSPF区域间的路由。只在区域内传输

汇总单个区域的LSA通告给其它区域的路由器,在整个OSPF的AS中泛洪。

Type4 -->  Sum-Asbr :与ASBR在同一个区域的ABR产生的,表示ASBR的名字;只在区域内传输

          将1类型和5类型关联起来,找出实际走的路径(就像主机要找外面的主机,要指 向网关)在整个OSPF的AS中泛洪。

Type5 -->  External :只有普通区域的ASBR可以产生,表示OSPF外部路由;全网都可以传输

(这一条很重要,因为全网穿越,如果对应的外网不稳,将导致全网不稳,导致用户上网感觉断断续续

所以实际工作中,会采用相关配置,防止不必要的LSA 5穿越,影响整个网性能)

将其它AS中的路由信息封装,并传递。在整个OSPF的AS中泛洪。

Type7 -->  NSSA :只有NSSA区域的ASBR可以产生,表示OSPF的外部路由;只在区域内传输

使NSSA区域的ASBR引入的外部路由,并在NSSA区域泛洪,通过区域内的ABR 转化为LSA3包并传到其它OSPF区域,转化LSA7包的ABR同时成为其它路由器眼中的ASBR。

作为一种技术手段,为了解决不要别人的LSA5,自己又需要相应的外部路由,这种应用场景下产生的LSA7。要顺着应用场景中遇见的问题逐步深入,就能发现各类LSA出现的必然性。

从上总结可以看出,每个路由器,DR(每一网段都有),ABR(区域边界路由器),ASBR(自治系统边界路由器,Autonomous System Boundary Router),External(全部网络),NSSA(非纯末梢区域);大概范围逐渐缩小,除了最后两个。

四、除了hello报文,其他ospf都携带LSA:link state advertise相关说明(以下实际Link state Database提取的信息)

OSPF Process 1 with Router ID 30.3.6.0
Link State Database

Area: 0.0.0.30  //Area 30

Type         LinkState ID    AdvRouter   Age     Len    Sequence   Metric
Router          30.3.70.0       30.3.70.0      3      48    80000007   1

//一类LSA:router lsa的 link state id:生成这条LSA的路由器的router id;即以所在路由器的router-id作为链路状态标识ID。
//每个路由器都可以发送,仅在自己的area区域发送,通告自身信息(自报家门),这种LSA描述某区域内路由去端口链路状态的集合,只在所描述的区域内泛洪(组播)。

Router          30.3.6.0         30.3.6.0        7      36         80000004         1
Network       192.168.67.7       30.3.70.0      3      32         80000002         0

//二类LSA:network lsa的 link state id:描述网段上DR的端口ip地址。即以所在路由器DR的端口IP地址作为链路状态标识ID
//只有DR可以发出,用于描述广播型网络和NBMA网络,仅在自己area区域发送,通告DR的位置和身份,这种LSA包含了该网络上所有连接路由器的列表。

//(MA网络中存在,有多个路由器,产生广播时才有。在点到点,点到多点网络中是没有2类LSA的)

Sum-Net      192.168.45.0       30.3.6.0       13     28         80000001         2
Sum-Net      192.168.23.0    30.3.6.0       13      28        80000001         4

//三类LSA:summary lsa的 link state id :描述区域内所有网段的路由,并通告给其他相关区域;即以所在网段作为作为链路状态标识ID
//只能由ABR发送
//可以穿越整个ospf自制系统(中间需要多个ABR中转)除过stub,NSSA区域。
//将不同区域对的ospf路由信息互相传递

Sum-Net      192.168.56.0    30.3.6.0       13      28        80000001         1
Sum-Net      192.168.20.0    30.3.6.0       13      28        80000001         5
Sum-Net      192.168.34.0    30.3.6.0       13      28        80000001         3
Sum-Net      192.168.13.0    30.3.6.0       25      28        80000001         4
Sum-Net      192.168.12.0    30.3.6.0       25      28        80000001         5
Sum-Net      192.168.50.0    30.3.6.0       26      28        80000001         7
Sum-Net      192.168.95.0       30.3.6.0      26       28       80000001          6
Sum-Net      192.168.19.0       30.3.6.0      26       28       80000001          5
NSSA           0.0.0.0                30.3.6.0       26       36      80000001          1
NSSA          192.168.40.0       30.3.70.0       110      36      80000001          1

//七型LSA:nssa lsa的 link state id: 描述目的网段的地址; 即以所在网段作为作为链路状态标识ID;
//由位于nssa区域的ASBR产生,发送范围仅仅是nssa区域(传至abr时会转换成5型继续传递)作用是将nssa区域后的其他自制系统的路由引入ospf自制系统。

AS External Database

Type           LinkState ID    AdvRouter        Age    Len         Sequence        Metric
External      192.168.40.0       30.3.6.0     22      36      80000001      1
External      0.0.0.0            20.1.9.0     369    36      80000001           1

OSPF Process 1 with Router ID 20.1.1.0
Link State Database

Area: 0.0.0.20   //Area 20

Type              LinkState ID             AdvRouter           Age           Len           Sequence            Metric
Router            20.1.3.0                    20.1.3.0             168             48            80000009            1
Router            20.1.9.0                    20.1.9.0             165             48            80000008            1
Router            20.1.2.0                    20.1.2.0              172            48            80000008            1
Router            20.1.10.0                  20.1.10.0            169            48            80000008            1
Router            20.1.1.0                    20.1.1.0              170            72            8000000B            1
Network         192.168.23.3             20.1.3.0              172            32            80000002            0
Network         192.168.95.10           20.1.10.0            169            32            80000003            0
Network         192.168.13.3             20.1.3.0              173            32            80000002            0
Network         192.168.12.2             20.1.2.0              173            32            80000003            0
Network         192.168.19.9             20.1.9.0              165            32            80000003            0
Sum-Net        192.168.67.0             20.1.3.0              1673          28            80000002            4
Sum-Net        192.168.45.0             20.1.3.0              148            28            80000002            2
Sum-Net        192.168.56.0             20.1.3.0              148            28            80000002            3
Sum-Net        192.168.34.0             20.1.3.0              206            28            80000002            1
Sum-Net        192.168.30.0             20.1.3.0              1668          28            80000001            5
Sum-Asbr       30.3.6.0                    20.1.3.0              1673          28            80000001            3

//四型LSA:asbr lsa的 link state id:描述到ASBR的路由,通告给除ASBR所在区域的其他相关区域;即以所在路由器的Router ID作为作为链路状态标识ID。
//只能ABR发送,发送范围整个ospf自制系统,通告ABR的身份信息

AS External Database

Type               LinkState ID            AdvRouter           Age           Len           Sequence           Metric
External           0.0.0.0                    20.1.9.0              210            36            80000002           1
External          192.168.40.0           30.3.6.0              1671           36           80000001           1

//五型LSA:external lsa的 link state id: 描述目的网段的地址; 即以所在网段作为作为链路状态标识ID
//ASBR发送,发送范围整个ospf自制系统,通告其他自制系统的路由信息,5类LSA在整个AS内部泛洪,在传递过程中不发生变化。

小结:ospf路由器无法删除不是自己生成的LSA,

以下总结摘自 昭哥-HYZ(不知先生真名,总结的很好,感谢!):https://blog.csdn.net/u010091664/article/details/123196555

1类LSA:router -LSA

传播范围:本区域内传输
Link ID : 产生者的router-id

2类LSA :network LSA

传播范围:只在本区域内传输,终止于ABR
Link ID:DR接口的IP地址

3类LSA :summary LSA

功能:用于在区域之间传递路由信息
Link ID :传递路由的网络号(网段)

4类LSA: summary ASBR LSA

功能:除了ASBR所在区域外,用于通告ASBR位置
Link ID:ASBR的router-id

5类LSA: 外部LSA

功能: 用于在整个OSPF中传递外部路由(原本不属于OSPF域的路由)
Link ID :传递外部路由的网络号(网段)

7类LSA: NSSA LSA

功能: 将nssa区域后的其他自制系统的路由引入ospf自制系统
Link ID :传递外部路由的网络号(网段)

五、帧机构及说明(后面是外网搜集的,FYI)

Introduction to OSPF

Open Shortest Path First (OSPF) is one of the Interior Gateway Protocol (IGP), which helps to find the best routing path between the source and the destination router using its own shortest path first (SPF) algorithm. It is a Link-state routing protocol that is used to distribute routing information about data packets within a large Autonomous System.

OSPF Areas

An autonomous system can be divided into areas; these help in reducing the link state advertisements and other overhead traffic that will be otherwise sent to the network.

 

Let’s take a look:

    • Backbone Area: It is also known as area0 or area 0.0.0.0; it forms the very core of an OSPF network, and all other areas of the network are connected to the backbone area. It is responsible for distributing routing information between areas that are not backbone area types.
    • Stub Area: In the case of Stud Area, routing in the area is entirely on the basis of a default route. It is an area that does not receive advertisements external to the autonomous system (AS)
    • Not So Stubby Areas: NSSA is a type of stub that is able to import AS external routes and send them to any other area. However, it is unable to receive AS external routes from other areas of the network.
    • Transit Areas: It is an area with 2 or more OSPF border routers, and it can be used to pass network traffic from one adjacent area to another one. It does not originate traffic, and neither it is the destination of any such traffic.

How OSPF Works?

When it is configured, it listens to its neighbours in the networks, and it gathers all the link state data available. This data is then used to make a topology map that contains all available paths in the network. This database is saved for use, and we call it Link State Database.

Once the Link State Database is made, it is used to calculate the shortest path to subnets/networks using an algorithm known as Shortest Path First, developed by Edsger W Dijkstra. OSPF creates 3 tables:

    • Routing Table: It contains currently working best paths that will be used to forward traffic between two neighbours.
    • Neighbour Table: This contains all discovered Open Short Path First neighbours.
    • Topology Table: This one contains the entire road map of the network. This road map includes all the available Open Short Path First routers and keeps calculated data about best and alternative paths.

Router Types in OSPF

    • Internal Router: This router contains all interfaces that belong to each other in the same area.
    • Area Border Router: ABR connects one or more areas with a backbone network. An ABR is considered a member of all the areas it is connected to. It keeps multiple Link State databases in the memory, one for each area.
    • Backbone Router: A router that has an interface to a backbone area is called a backbone router.
    • Autonomous System Boundary Router: ASBR is a router that is connected to the network with more than one routing protocol. ASBR exchanges routing info with routers autonomous systems. These run an exterior routing protocol, use stating routes or even use both methods.

Applications of Open Shortest Path First

OSPF is the first widely deployed routing protocol. It can converge with a network in a few seconds, and it is one of the protocols that can provide loop-free paths. Aside from these features, Open Short Path First allows the imposition of policies for the propagation of routes in the network.

Open Short Path First is better at load sharing on external links compared to other IGPs. Considering these benefits, it can found widespread use.

Implementations of Open Short Path First

    • Microsoft’s Windows NT 4.0 Server, Windows 2000 Server and Windows Server 2003 all have OSPF v2 in the Routing and Remote Access Services. Microsoft Removed the support with the Windows Server 2008 and later version of Server Operating Systems by the company.
    • OpenBSD Operating system has an implementation of OpenBGPD protocol which has OpenOSPFD implementation.
    • BIRD implements OSPFv2 and OSPFv3 both.
    • GNU Zebra is a GPL routing suite that supports OSPF for Unix-Like systems.
    • Multi-Protocol Routing module in Netware has support for OSPF.

Advantages and Disadvantages of OSPF

Below are the advantages and disadvantages:

Advantages

Below are the advantages:

    • Open Short Path First is easily scalable, meaning with a very little amount of hassle, we can scale it to use in a very big network.
    • Open Shortest Path First Protocol has full support for subnets.
    • Use of Hello Packets: Open Short Path First sends small hello packets to verify link operations and ignores transferring large tables.
    • OSPF Supports route tagging: In Open Short Path First, routes can be tagged to ease interoperation with arbitrary values.
    • Routing: Open Short Path First is able to route packets based on their type of service field.

Disadvantages

Below are the disadvantages:

    • It is a processor-intensive protocol to use.
    • Because it maintains more than one copy of routing information, it consumes more memory.
    • It is a more complex protocol to understand and learn compared to other Internet Protocols.

Conclusion

Open Shortest Path First, as a routing protocol, has an important place in internet infrastructure. Finding the shortest path easily and quickly helps reduce unnecessary network load, and the ability to find another path in case of error at the optimal one helps increase the stability of the network.

最新文章

  1. Flash+fms视频录制在项目中的实际应用
  2. Python 7 —— 扩展与嵌入
  3. python中的argparse
  4. Linux 网络编程详解四(流协议与粘包)
  5. Linux下MySQL忘记密码
  6. C语言也能干大事1
  7. The Longest Increasing Subsequence (LIS)
  8. z-score
  9. Win7,8的上帝模式文件夹 GodMode.{ED7BA470-8E54-465E-825C-99712043E01C}
  10. laravel Passport - 创建 REST API 用户认证以及Dingo/Api v2.0+Passport实现api认证
  11. IntelliJ IDEA配置Maven
  12. C# .net 语言加密方案
  13. notepad++之删除空行
  14. 【BJOI2019】排兵布阵 DP
  15. iOS: 数据持久化方案
  16. NET Core 指令启动
  17. September 14th 2017 Week 37th Thursday
  18. java中+=详解 a+=b和a=a+b的区别
  19. vue.js 知识点(二)
  20. HDU 4584 Building bridges (水题)

热门文章

  1. SpringCloud 源码学习笔记2——Feign声明式http客户端源码分析
  2. K3S 系列文章-RHEL7.8 离线有代理条件下安装 K3S
  3. vue+mysql实现前端对接数据库
  4. 多资产VAR风险--基于python处理
  5. Vicinity Vision Transformer概述
  6. lg9018题解
  7. 解决React 安装 antd 后出现的Module not found: Can't resolve './locale' in '...rc-picker/node-modules.....'一系列问题问题
  8. Windows 下安装 Bun:像 Node 或 Deno 一样的现代 JavaScript 运行时
  9. js中常用Math对象
  10. VIT论文笔记