LSA and special area

1. LSA overview and common LSA types

category name description
1 Router LSA
(Router LSA)
The LSA generated by each OSPF router describes the status and cost value of all OSPF directly connected ports of the router. The LSA can only be flooded in the area to which the interface belongs
2
Network LSA (Network LSA)
Generated by the DR, describing all the routers in the MA network that the DR is connected to, including the DR itself. The LSA can only be flooded in the area where the interface belongs
3 Network Summary LSA
(Network Summary LSA)
Produced by ABR, it describes the route to the target network segment in a certain area. This type of LSA is mainly used to transfer routes between areas
4 ASBR Summary LSA
(ASBR Summary LSA)
Produced by ABR, used to describe ASBR. ASBR summary LSA is equivalent to a "host route" to the ASBR
5 AS summary LSA
(AS External LSA)
Generated by ASBR, used to describe external routes outside of this AS
6 Incomplete peripheral area LSA
(NSSALSA)
Generated by ASBR, used to describe external routes outside this AS. The NSSA LSA only floods in the NSSA that generated this LSA, and cannot directly enter the backbone area. The ABR of NSSA converts Type 7 LSA into Type 5 LSA and injects it into the backbone area

2.LSA header

Insert picture description here
One or more complete LSAs are carried in the LSU packet


Insert picture description here

Field length meaning
Link state aging time
(Link-State Age)
16 bit Indicate the aging time of the LSA, that is, how long it has existed, in seconds. No matter whether the LSA is transmitted on the link or stored in the LSDB, its value will keep increasing
Options
(Options)
8-bit Each bit corresponds to a certain feature supported by OSPF
Link state type
(Link-State Type)
8-bit Indicates the type of this LSA. OSPF defines multiple types of LSAs. Each type of LSA is used to describe a certain part of the OSPF network. All LSA types have corresponding type numbers.
Link state ID
(Link State-ID)
32 bit The identifier of the LSA. Different LSA types have different definitions of this field.
Advertising Router
(Advertising Router)
32 bit The Router-ID of the router that generated the LSA.
Link state sequence number
(Link-Sate Sequence Number)
32 bit The sequence number of the LSA. This field is used to determine whether the LSA is new or old or whether there is a duplication.
And link status check
(Link-State Checksum)
16 bit Checksum.
Length
(Length)
16 bit The total byte length of the LSA.

3. Detailed LSA

Test topology
Insert picture description here

1.Type-1 LSA (Router LSA)

(Router LSA) The
router uses this LSA to describe its "condition at the door". Each router running OSPF will generate a Type-1 LSA. This LSA describes the status of the router's direct connection port and the interface cost. The ports belonging to the same area share a Type-1 LSA description. When the router has multiple interfaces When belonging to different areas, it will generate a Type-1 LSA separately for each area, and each LSA only describes the access to that area.
Insert picture description here

Field length meaning
V位
(Virtual Link Endpoint Bit)
1 bit 如果该比特位被设置为1,则表示该路由器为Virtual Link的端点。
E位
(External Bit)
1比特 如果E比特位被设置为1,则表示该路由器为ASBR。
在Stub区域中,不允许出现E比特位被设置为1的Type-1 LSA,因此Stub区域内不允许出现ASBR.
B位
(Border Bit)
1比特 如果B比特位被设置为1,则表示该路由器为两个区域的边界路由器,字母B意为Border (边界)。
一台路由器如果同时连接两个或两个以上的区域,则其产生的Type-1 LSA会将B比特位设置为1,即使它没有连接到Area0.
链路数量
(Links Number)
16比特 链路数量"字段指明在该Type-1 LSA中,包含了几条Link,每条Link均包含“链路类型”“链路ID" “链路数据”以及“度量值”这几个关键信息。路由器可能会采用一个或者多个Link来描述某个接口。
链路类型
(Link Type)
8比特 本条Link的类型值,该值与Link的类型相关。
OSPF定义了多种链路类型,这些链路类型与接口的网络类型也是有关的。需要格外注意的是, OSPF的网络类型与链路类型是不同的概念,大家不要搞混淆。
链路ID
(Link ID)
32比特 Link的标识,不同的链路类型,对链路ID值的定义是不同的。
链路数据
(Link Data)
32比特 不同的链路类型对链路数据的定义是不同的。
度量值
(Metric)
16比特 Cost值。
链路类型 描述 链路ID 链路数据
1 对点连接到另一台路由器 邻居的Router-ID 产生该LSA的路由器的接口IP地址
2 连接到一个传输网络 DR的接口IP地址 产生该LSA的路由器的接口IP地址
3 连接到一个末梢网络 网络IP地址 网络掩码
4 虚链路 邻居的Router-ID 产生该LSA的路由器的接口IP地址

R1产生的Type-1 LSA会在这个area 0内泛洪。
其中有两条Link
g0/0/1链路类型=3(表示连接到一个末梢网络)链路ID=192.1688.1.0(该接口所属的网络地址),链路数据=255.255.255.0(掩码),度量值=1(接口的cost值)
g0/0/0链路类型=2(表示连接的一个传输网络),链路ID=192.168.123.3(DR的接口IP地址)链路数据=192.168.123.1(本接口IP地址),度量值=1.

Insert picture description here
R3产生的Type-1 LSA
由于该P2P接口上存在一个全毗邻的邻居,因此OSPF用两个link来描述

Link1 链路类型=1(表示点到点连接到另一台路由器)链路ID=4.4.4.4(邻居ID)链路数据=192.168.34.3(本接口ID)度量值=48

Link2 链路类型=3(表示连接的一个末梢网络)链路ID=192.168.34.0,链路数据=255.255.255.0,度量值=48

Link1 用来绘制拓扑,需要知道对端路由器的ID和IP地址。
Link2 用来描述这段链路的网段信息,需要网络地址和掩码。
Insert picture description here

2.Type-2 LSA(网络 LSA)

Type-2 LSA仅存在于拥有MA网络的区域中,该LSA由DR产生。
Insert picture description here
在Type-2 LSA中, LSA头部中“链路状态类型”字段的值为2, “链路状态ID"字段的值为产生这个Type-2 LSA的DR的接口IP地址。

字段 长度 含义
网络掩码
(Network Mask)
32比特 该MA网络的网络掩码。
相连的路由器(Attached Router)的Router-ID 32比特 连接到该MA网络的路由器的Router-ID (与该DR建立了邻接关系的邻居的Router-ID,以及DR自己的Router-ID),如果有多台路由器接入该MA网络,则使用多个字段描述。

DR泛洪Type-2 LSA到整个area 0。
Insert picture description here
在Type-1、Type-2泛洪后,整个区域内的路由器的LSDB就同步完成了,路由器将自己基于某个直连区域内泛洪的Type-1及Type-2 LSA计算得到的路由视为区域内部路由(Intra-Area Route)


R3根据Type-1、Type-2绘制出的网络拓扑及网段信息
Insert picture description here
R3计算完成后生成的最短路径树
Insert picture description here

3.Type-3 LSA(网络汇总 LSA)

Type-3 LSA是由ABR产生的,用于解决区域之间的路由传递问题。
Insert picture description here

字段 长度 含义
网络掩码(Netmask) 32比特 区域间路由的目的网络掩码。
度量值(Metric) 路由的Cost

PS:由于TOS及TOS度量值在RFC2328中不再支持(这些字段被保留仅是为了兼容早期的OSPF版本),可以忽略。

R3把描述Area 1内192.168.34.0/24网段的Type-3 LSA注入到Area 0
Insert picture description here
Type-3 LSA:链路状态ID,192.168.34.0(该路由的目的网络地址),网络掩码,255.255.255.0,通告路由器R3,cost:48(实际上就是R3自己到达目标网段的cost)

收到这个LSA后R1,R2就可以计算到达192.168.34.0/24网段的区域间路由,cost为49(也就是48+1,加上自己的g0/0/0接口的cost)
Insert picture description here
R3同样也会把Area 0里的三个网段的Type-3 LSA注入到Area 1里。

4.Type-4 LSA(ASBR 汇总LSA)

ASBR(Autonomous System Boundary Router, 自治系统边界路由器)将域外的路由(例如RIP路由、静态路由等)引入OSPF, OSPF使用Type-5 LSA描述这些外部路由, Type-5 LSA能够在整个OSPF域内泛洪(除了一,些特殊的区域),这样所有的路由器都能知晓这些到达外部的路由,然后通过Type-4 LSA通告给其他区域的路由器。

Type-4 LSA称为ASBR汇总LSA (ASBRSummary LSA),由ABR产生,实际上是一条到达ASBR的主机路由。Type-4 LSA的格式与Type-3 ISA是一致的。在Type-4 LSA中, “链路状态ID"字段的值是ASBR的Router-ID,而且“网络掩码”字段的值为全0,另外, “度量值”字段填写的是该ABR自己到达ASBR的Cost值。

Insert picture description here
在R4上引入外部路由10.0.0.0/8,R4产生Type-5 LSA描述这条外部路由并向整个OSPF域泛洪。

R4会修改其产生的Type-1 LSA中的E比特位设置为1,用来宣告自己的ASBR身份。

然而对于Area0内的R1及R2而言,它们虽然能够通过Type-5 LSA知晓10.0.0.0/8这个外部网络,但是却无法进行路由计算,因为它们并不知道如何到达ASBR (R4产生的Type-1 LSA只在Areal内泛洪)。

因此, R3作为与ASBR同属一个区域的ABR,会产生描述该ASBR的Type-4 LSA并在Area0内泛洪,从而Area0内的R1及R2便能够计算出到达10.0.0.0/8的外部路由并将其加载到路由表。

值得注意的是,这些路由器并不将通过Type-4 LSA计算出来的到达ASBR的路由加载到全局路由表中,而只是存放在一个特殊的数据表里。在路由器上使用display ospf abr-asbr命令可以看到路由器发现的ABR及ASBR。

5.Type-5 LSA(AS 汇总LSA)

当ASBR将外部路由引入OSPF时,会产生Type-5LSA用于描述这些外部路由,这种类型的LSA一旦被产生后,会在整个OSPF域内传播(除了一些特殊区域)。

Type-5 LSA也就是AS外部LSA (AS External LSA)
Insert picture description here
对于Type-5 LSA, "链路状态ID"字段的值是外部路由的目的网络地址。

字段 长度 含义
网络掩码(Netmask) 32比特 外部路由的目的网络掩码。
E位 1比特 用于表示该外部路由使用的度量值类型。
OSPF定义了两种外部路由度量值类型,分别是Metric-Type-1和Metric-Type-2,如果该比特位被设置为1,则表示外部路由使用的度量值类型为Metric-Type-2,如果该比特位被设置为0,则表示外部路由使用的度量值类型为Metric-Type-1
度量值(Metric) 24比特 该外部路由的Cost
转发地址(Forwarding Address, FA) 32比特 当FA为0.0.0.0时,则到达该外部网段的流量会被发往引入这条外部路由的ASBR。而如果FA不为0.0.0.0,则流量会被发往这个转发地址。
FA这一概念的引入,使得OSPF在某些特殊的场景中得以规避次优路径问题。
外部路由标记(External Route Tag) 32比特 这是一个只有外部路由才能够携带的标记,常被用于部署路由策略。
缺省为1

Insert picture description here
当一条外部路由被引入OSPF时, ASBR除了会设置该路由的外部Cost值,还会设置其度量值类型,这两个值最终都会被写入Type-5 LSA的相关字段中。

一台路由器在收到Type-5 LSA后,需要检查引入该外部路由的ASBR是否可达,如果该ASBR可达,路由器才会使用该Type-5 LSA进行外部路由计算。

In addition, for different external routing metric types, the routing cost algorithm is different. Assuming that the external Cost of a Type-5 LSA is B, and the cost of the path from the router to the ABSR that produced this Type-5 LSA is A, when the metric type of the Type-5 LSA is Metric-Type-1 , calculate The cost of this external route is equal to A+B, but if the metric type is Metrc-Type-2 , the cost of the route is equal to B.

6.Type-7 LSA (not completely peripheral area LSA)

Type-7 LSA is a non-peripheral region completely outside the LSA (Not-So-External Area the Stubby the LSA ). This is a special type of LSA, which is also used to describe OSPF external routing, and its message format is consistent with Type-5 LSA, but its flooding range is strictly limited-it can only be used in N SSA (Not- So-Stubby Area, not completely peripheral area ) flooded, and can not enter Area 0.

Insert picture description here
Area 1 is modified from the original regular area to NSSA. R4 introduces the external route 10.0.0.0/8 into OSPF. As an ASBR, it will generate a Type-7 LSA describing the route for the NSSA of Area 1. In this way, in Area 1 The other routers can calculate the external route to 10.0.0.0/8 based on this LSA. In addition, the ABR-R3 of the NSSA will be responsible for converting this Type-7 LSA into a Type-5 LSA, and inject the Type-5 LSA into Area 0, and then propagate it to the entire OSPF domain.

From the above output, we can see that there are two Type-7 LSAs flooded in Area 1. One of them is generated by ASBR-R4 to describe the external route 10.0.0.0/8, and the other is from ABR- R3 automatically generates a default route, and this default route can only be propagated in Area 1.

Guess you like

Origin blog.csdn.net/weixin_45793782/article/details/112388966