OSPF的LSA类型种类繁多,而OSPF又是目前应用最广泛的IGP协议,我们不得不对它进行研究。OSPF的LSA类型一共有11种,分别是:
LSA1 路由器LSA(Router LSA)
LSA2 网络LSA(Network LSA)
LSA3 网络汇总LSA(Network summary LSA)
LSA4 ASBR汇总LSA(ASBR summary LSA)
LSA5 自治系统外部LSA (Autonomous system external LSA)
LSA6 组成员LSA (Group membership LSA) *目前不支持组播OSPF (MOSPF协议)
LSA7 NSSA外部LSA (NSSA External LSA)
LSA8 BGP的外部属性LSA(External attributes LSA for BGP)
LSA9 不透明LSA(本地链路范围) (opaque LSA) *目前主要用于MPLS多协议标签交换协议
LSA10 不透明LSA(本地区域范围) (opaque LSA) *目前主要用于MPLS多协议标签交换协议
LSA11 不透明LSA(AS范围) (opaque LSA) *目前主要用于MPLS多协议标签交换协议
这11种LSA中,NP阶段我们主要研究其中的LSA1、2、3、4、5、7。其余的在一些特殊环境使用,暂时不对它们进行深入的探讨。
请先看一幅图,此图涵盖了我们所研究的6种LSA类型在OSPF环境中的作用。
* 图中ADV是通告路由器;ABR是区域边界路由器;ASBR是自治系统边界路由器。
① LSA1 路由器LSA(Router LSA)
描述路由器的直连链路状态信息。由每个发起路由器通告,只在本区域内传递,不会超过ABR。
② LSA2 网络LSA(Network LSA)
描述本区域内BMA/NBMA(串行连接信息不会在此出现)的网络信息以及连接到此网络的路由器。由本BMA/NBMA网络的DR或BDR通告,只在本区域传递。
③ LSA3 网络汇总LSA(Network summary LSA)
描述OSPF的区域间路由(在路由表中以 O IA 标识)。原LSA 1所描述的路由信息会由所在区域的ABR将其转换为LSA 3。
LSA3可以传播到整个OSPF的所有区域(特殊区域除外)。由ABR通告。
注意:LSA 3每穿越一个ABR,其ADV Router都会发生改变,ADV Router转变为最后一次穿越的ABR路由器。
④ LSA5 自治系统外部LSA (Autonomous system external LSA)
没有看错,这里是LSA 5,我们先讲LSA 5再反过来看LSA 4。
LSA 5描述的是OSPF区域以外的路由(RIP、EIGRP、BGP等等)。由ASBR所通告,LSA 5可以传播到整个OSPF的所有区域(特殊区域除外)。
注意:LSA 5的通告路由器在穿越ABR的时候是不会改变的。
⑤ LSA4 ASBR汇总LSA(ASBR summary LSA)
LSA 4所承载的内容是:ASBR的Router-ID。LSA 4其实就是图中R4(通告路由器)将Area 3中R11的Router-ID信息转换为LSA 4,在整个OSPF域中泛洪传播(由于LSA 5的通告路由器在穿越ABR的时候不会改变,如图中Area 3的LSA 5在穿越R4到达Area 0时,通告路由器不改变仍然是R11,因此除了Area 3,Area 0和其他区域都不知道R11的信息。此时就需要LSA 4为Area0和其他区域提供R11的信息,可以这么说,LSA 4是为LSA5所服务的)。
⑥ OSPF的特殊区域:Stub Area末梢区域
在Stub区域中只有域内和域间路由。只允许LSA 3进入本区域,LSA 4/5不允许进入。配置Stub区域后会在区域内自动的生成一条默认路由(以便访问OSPF中其他区域的网络)。
⑦ OSPF的特殊区域:Total Stub Area绝对末梢区域
在Total Stub Area中只有本区域内的路由。LSA3/4/5均不允许进入本区域。配置Total Stub Area后会在区域内自动的生成一条默认路由(以便访问OSPF中其他区域的网络)。
⑧ OSPF的特殊区域:NSSA Area次末梢区域
在NSSA区域中允许存在ASBR,所以也就可以引入外部路由。这个外部路由在NSSA区域内以LSA 7存在。当此LSA 7路由离开NSSA区域进入别的区域时,NSSA的ABR会进行LSA 7向LSA 5的转换(如图Area 6所示)。
本区域只允许LSA 3进入,禁止LSA4/5的进入。所以此区域有域内、域间和外部路由。
配置NSSA区域需要在区域内手工的创建一条默认路由(以便访问OSPF中其他区域的网络)。
# router ospf x
# area 6 nssa default-information-originate
⑨ OSPF的特殊区域:Total NSSA Area绝对次末梢区域
在NSSA区域中允许存在ASBR,所以也就可以引入外部路由。这个外部路由在NSSA区域内以LSA 7存在。当此LSA 7路由离开NSSA区域进入别的区域时,NSSA的ABR会进行LSA 7向LSA 5的转换(如图Area 7所示)。
本区域禁止LSA3/4/5进入,只有本区域内路由和外部路由。配置Total NSSA Area后会在区域内自动的生成一条默认路由(以便访问OSPF中其他区域的网络)。
下边是WIKIPEDIA上各LSA的英文注释:
The LSA types defined in OSPF are as follows:
- Type 1 - Router LSA - the router announces its presence and lists the links to other routers or networks in the same area, together with the metrics to them. Type 1 LSAs are flooded across their own area only. The link-state ID of the type 1 LSA is the originating router ID.
- Type 2 - Network LSA - the designated router (DR) on a broadcast segment (e.g. Ethernet) lists which routers are joined together by the segment. Type 2 LSAs are flooded across their own area only. The link-state ID of the type 2 LSA is the IP interface address of the DR.
- Type 3 - Summary LSA - an Area Border Router (ABR) takes information it has learned on one of its attached areas and summarizes it before sending it out on other areas it is connected to. This summarization helps provide scalability by removing detailed topology information for other areas, because their routing information is summarized into just an address prefix and metric. The summarization process can also be configured to remove a lot of detailed address prefixes and replace them with a single summary prefix, helping scalability. The link-state ID is the destination network number for type 3 LSAs.
- Type 4 - ASBR-Summary LSA - this is needed because Type 5 External LSAs are flooded to all areas and the detailed next-hop information may not be available in those other areas. This is solved by an Area Border Router flooding the information for the router (i.e. the Autonomous System Boundary Router) where the type 5 originated. The link-state ID is the router ID of the described ASBR for type 4 LSAs.
- Type 5 - External LSA - these LSAs contain information imported into OSPF from other routing processes. They are flooded to all areas unchanged (except stub and NSSA areas). For "External Metric Type 1" LSAs routing decisions are made using the Type 1 metric cost sent, as the total cost to get to the external destination and includes the cost to the ASBR; while for "External Type 2" LSAs the metric sent is the cost from the ASBR to the External destination network and must be added to the OSPF cost to the ASBR advertising the Type 5. The link-state ID of the type 5 LSA is the external network number.
- Type 6 - Group Membership LSA (Only supported on a few routers) - this was defined for Multicast extensions to OSPF (MOSPF),[1] a multicast OSPF routing protocol which was not in general use. MOSPF has been deprecated since OSPFv3[2] and is not currently used. It may be reassigned in the future.
- Type 7 - Routers in a Not-so-stubby-area (NSSA) do not receive external LSAs from Area Border Routers, but are allowed to send external routing information for redistribution. They use type 7 LSAs to tell the ABRs about these external routes, which the Area Border Router then translates to type 5 external LSAs and floods as normal to the rest of the OSPF network.
- Type 8 - A link-local only LSA for OSPFv3. A Type 8 LSA is used to give information about link-local addresses and a list of IPv6 addresses on the link. In OSPFv2, however, the Type 8 was originally intended to be used as a so-called External-Attributes-LSA for transit autonomous systems where OSPFv2 could replace the internal Border Gateway Protocol (iBGP). In these networks, the BGP destinations would be carried in LSA Type 5 while their BGP attributes would be inserted into LSA Type 8. Most OSPFv2 implementations never supported this feature.
- Type 9 - a link-local "opaque" LSA (defined by RFC2370) in OSPFv2 and the Intra-Area-Prefix LSA in OSPFv3. It is the OSPFv3 LSA that contains prefixes for stub and transit networks in the link-state ID.
- Type 10 - an area-local "opaque" LSA as defined by RFC2370. Opaque LSAs contain information which should be flooded by other routers even if the router is not able to understand the extended information itself. Typically type 10 LSAs are used for traffic engineering extensions to OSPF, flooding extra information about links beyond just their metric, such as link bandwidth and color.
- Type 11 - an AS "opaque" LSA defined by RFC 5250, which is flooded everywhere except stub areas. This is the opaque equivalent of the type 5 external LSA.[3]