区域类型对应的LSA:
backbone                1   2  3  4  5 
no-backbone,no-stub     1   2  3  4  5 
stub                    1   2  3        and A Default Route
totally stubby          1   2           and A Default Route 
not-so-stubby           1   2  3  7 
nssa no-summary         1   2  7        and A Default Route

调整区域类型:
backbone                
no-backbone,no-stub     
stub               R1(config-router)#area 1 stub            
totally stubby     R1(config-router)#area 1 stub no-summary      
not-so-stubby      R1(config-router)#area 1 nssa 
nssa no-summary    R1(config-router)#area 1 nssa no-summary

查看对应的LSA:
1     R1#show ip ospf database router (该区域内的每个路由器产生)
2     R1#show ip ospf database network  (该区域内DR产生)
3     R1#show ip ospf database summary  (ABR产生)
4     R1#show ip ospf database asbr-summary (ABR产生,描述到ASBR距离)
5     R1#show ip ospf database external (ASBR产生,描述到AS外的路由)
7     R1#show ip ospf database nssa   (ASBR产生,仅在NSSA传递,ABR转换成5内到其他区域)

类型1的LSA : link-id= router-id
类型2的LSA : link-id=DR的接口IP
类型3的LSA : link-id=目的网络号
类型4的LSA : link-id= ASBR router-id
类型5的LSA : link-id= 外部网络号
类型7的LSA : link-id= 外部网络号

       5       External LSA
在LSA5类中的Forward Address:

The value of the forwarding address specified by the autonomous system boundary router (ASBR) (Router 1 in the previous figure) can be either 0.0.0.0 or non-zero. The 0.0.0.0 address indicates that the originating router (the ASBR) is the next hop. The forwarding address is determined by these conditions: 
•        The forwarding address is set to 0.0.0.0 if the ASBR redistributes routes and OSPF is not enabled on the next hop interface for those routes. 
•        These conditions set the forwarding address field to a non-zero address:
o        OSPF is enabled on the ASBR's next hop interface AND 
o        ASBR's next hop interface is non-passive under OSPF AND 
o        ASBR's next hop interface is not point-to-point AND 
o        ASBR's next hop interface is not point-to-multipoint AND 
o        ASBR's next hop interface address falls under the network range specified in the router ospf command. 
•        Any other conditions besides these set the forwarding address to 0.0.0.0.

Type 5
Forward != 0.0.0.0
外部路由的cost = 到forward address的cost + ASBR通告的type5的metric

Forward = 0.0.0.0
外部路由的cost = 到Advertising Router(show ip ospf border-routers)的cost + ASBR通告的type5的metric

OSPF 将引入的 AS 外部路由分为两类: Type1 Type2
第一类外部路由是指接收的是 IGP Interior Gateway Protocol ,内部网关协议)路由(例如静态路由和 RIP 路由)。由于这类路由的可信程度较高,并且和 OSPF 自身路由的开销具有可比性,所以到第一类外部路由的开销等于本路由器到相应的 ASBR 的开销与 ASBR 到该路由目的地址的开销之和。
第二类外部路由是指接收的是 EGP Exterior Gateway Protocol ,外部网关协议)路由。由于这类路由的可信度比较低,所以 OSPF 协议认为从 ASBR 到自治系统之外的开销远远大于在自治系统之内到达 ASBR 的开销。所以计算路由开销时将主要考虑前者,即到第二类外部路由的开销等于 ASBR 到该路由目的地址的开销。如果计算出开销值相等的两条路由,再考虑本路由器到相应的 ASBR 的开销。
                   

Type 3
Type的路由 = 到ABR的cost(show ip ospf border-routers) + ABR通告的Type3的路由cost(show ip ospf database summary)




4         ASBR 汇总 LSA

 

            ASBR 汇总 LSA 通告的是一个区域外部的 ASBR 路由器,且只能在单个区域中泛洪。由外部路由起源区域的 ABR 产生,泛洪到起源区域的整个 AS 中。

 

           LSA 传播范围:泛洪到整个 AS 中,(把 ASBR Router ID 传播到其他区域,让其他区域的路由器得知 ASBR 的位置。)

           LSA 通告路由器: ABR Router ID (经过一个 ABR ,就会改为这个 ABR Router ID

           LSA 链路状态 ID ASBR Router ID

           LSA 包含的内容:本区域中的路由信息,包括网络号和掩码

 

注意: ASBR 直连的区域内,不会产生 4 类的 LSA ,因为 ASBR 会发出 1 类的 LSA ,其中会指明自己是 ASBR

R1(config-if)#do show ip os da router

            OSPF Router with ID (1.1.1.1) (Process ID 100)

                Router Link States (Area 1)

  LS age: 1378
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 1.1.1.1
  Advertising Router: 1.1.1.1
  LS Seq Number: 8000002E
  Checksum: 0x9872
  Length: 72
  Number of Links: 4

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 10.10.10.10
     (Link Data) Network Mask: 255.255.255.255
      Number of TOS metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 1.1.1.1
     (Link Data) Network Mask: 255.255.255.255
      Number of TOS metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 9.9.15.1
     (Link Data) Router Interface address: 9.9.15.1
      Number of TOS metrics: 0
       TOS 0 Metrics: 10

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 9.9.12.1
     (Link Data) Router Interface address: 9.9.12.1
      Number of TOS metrics: 0
       TOS 0 Metrics: 10


  Routing Bit Set on this LSA
  LS age: 1728
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 2.2.2.2
  Advertising Router: 2.2.2.2
  LS Seq Number: 80000024
  Checksum: 0x397D
  Length: 36
  Area Border Router
  Number of Links: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 9.9.12.1
     (Link Data) Router Interface address: 9.9.12.2
      Number of TOS metrics: 0
       TOS 0 Metrics: 10


  Routing Bit Set on this LSA
  LS age: 1380
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 5.5.5.5
  Advertising Router: 5.5.5.5
  LS Seq Number: 80000014
  Checksum: 0xE6BC
  Length: 36
  Area Border Router
  AS Boundary Router
  Number of Links: 1

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 9.9.15.1
     (Link Data) Router Interface address: 9.9.15.5
      Number of TOS metrics: 0
       TOS 0 Metrics: 10

i 5.5.5.5 [10] via 9.9.15.5, FastEthernet0/1, ABR/ASBR, Area 1, SPF 55
i 2.2.2.2 [10] via 9.9.12.2, FastEthernet0/0, ABR, Area 1, SPF 55
I 3.3.3.3 [20] via 9.9.15.5, FastEthernet0/1, ASBR, Area 1, SPF 55
I 3.3.3.3 [20] via 9.9.12.2, FastEthernet0/0, ASBR, Area 1, SPF 55