CCIE SP-OSPF 小结2-数据库

此篇文章都是围绕下面的Topology来举的实例:

Topology:

Type 1/2:Router/Network LSA

在R3上查看R1和R5的Router LSA:

R3#sh ip ospf da router 1.1.1.1

            OSPF Router with ID (3.3.3.3) (Process ID 1)

                Router Link States (Area 11)

  LS age: 1912
  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: 80000004
  Checksum: 0x9E8A
  Length: 36
  Number of Links: 1

    Link connected to: a Transit Network
!---传输网络,也就是LAN,换句话说就是以太口
     (Link ID) Designated Router address: 123.1.1.3
!---DR的接口地址
     (Link Data) Router Interface address: 123.1.1.1
!---本路由器的接口地址
      Number of TOS metrics: 0
       TOS 0 Metrics: 1
!---以太口,所以Metric为1

R3#sh ip ospf da network 

            OSPF Router with ID (3.3.3.3) (Process ID 1)

                Net Link States (Area 11)

  Routing Bit Set on this LSA
  LS age: 1950
  Options: (No TOS-capability, DC)
  LS Type: Network Links
  Link State ID: 123.1.1.3 (address of Designated Router)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000002
  Checksum: 0xEDA2
  Length: 36
  Network Mask: /24
        Attached Router: 3.3.3.3
        Attached Router: 1.1.1.1
        Attached Router: 2.2.2.2

R3#sh ip ospf da router 5.5.5.5

            OSPF Router with ID (3.3.3.3) (Process ID 1)

                Router Link States (Area 0)

  Routing Bit Set on this LSA
  LS age: 243
  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: 80000005
  Checksum: 0x3D71
  Length: 96
  Area Border Router
  AS Boundary Router
  Number of Links: 6

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 6.6.6.6
     (Link Data) Router Interface address: 56.1.1.5
      Number of TOS metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 56.1.1.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 1
!---对于点到点链路,OSPF用2个link信息来描述一个真实的link 
!---换句话说,“another Router” 和 “a Stub Network”描述的是一个link 
!---目前为止,只有Type 1 SLA中的“Number of Links”与真实不符

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 4.4.4.4
     (Link Data) Router Interface address: 45.1.1.5
      Number of TOS metrics: 0
       TOS 0 Metrics: 20

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 45.1.1.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 20

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 3.3.3.3
     (Link Data) Router Interface address: 35.1.1.5
      Number of TOS metrics: 0
       TOS 0 Metrics: 64

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 35.1.1.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 64

Type 1/2 LSA的作用

对于Type 1/2 LSA来说,其实就是给路由提供下一跳地址的,这就解释了下面2个问题。
注意:对于提供下一跳地址,广播的链路有点特殊,因为涉及DR的选举,所以对于广播链路,Type 2 LSA提供了下一跳地址
1. 为什么在点到点链路,要有”a Stub Network” 和 “another Router” 的link信息?
因为它们提供了下一跳地址与掩码,所以是一对出现的。

2. 为什么在广播链路,要有Type 2 LSA?
因为对于Type 1 LSA来说,它只能提供”a Stub Network”,也就是说只能提供掩码
因此需要另一种LSA信息来表述下一跳,这就是Type 2 LSA,它指明了DR的接口地址,也就是下一跳

下面拿一个例子来证明下:

R1#sh ip route | i 56.1.1.0
O IA    56.1.1.0 [110/66] via 123.1.1.3, 00:17:38, FastEthernet1/0
!---下一跳"123.1.1.3"是怎么计算出来的?
R1#
R1#
R1#sh ip route 56.1.1.0
Routing entry for 56.1.1.0/24
  Known via "ospf 1", distance 110, metric 66, type inter area
  Last update from 123.1.1.3 on FastEthernet1/0, 00:17:20 ago
  Routing Descriptor Blocks:
  * 123.1.1.3, from 3.3.3.3, 00:17:20 ago, via FastEthernet1/0
      Route metric is 66, traffic share count is 1
!---"123.1.1.3"是从"3.3.3.3"学来的
R1#
R1#
R1#sh ip ospf da | i 56.1.1.0
56.1.1.0        3.3.3.3         1142        0x80000002 0x00C7EC
!---从数据库看,"56.1.1.0"是从"3.3.3.3"发来的LSA
R1#
R1#
R1#sh ip ospf da summary 56.1.1.0

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

                Summary Net Link States (Area 11)

  Routing Bit Set on this LSA
  LS age: 1235
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(Network)
  Link State ID: 56.1.1.0 (summary Network Number)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000002
  Checksum: 0xC7EC
  Length: 28
  Network Mask: /24
        TOS: 0  Metric: 65
!---详细确认从R3发来的LSA,看到有掩码和Metric,但还是没有下一跳地址。。。 
!---注意此处的掩码是对应"Link State ID"的"56.1.1.0",而不是R3的掩码 
!---Metric 65是当R3发送此LSA时带着的度量值
R1#
R1#
R1#sh ip ospf da router adv-router 3.3.3.3

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

                Router Link States (Area 11)

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

    Link connected to: a Transit Network
     (Link ID) Designated Router address: 123.1.1.3
     (Link Data) Router Interface address: 123.1.1.3
<<<2012-12-19更新:这里好像有点问题!应该是看123.1.1.3在本路由器上的metric
<<<因为就像下面说的,他只是r3发送时带的,不算路由的,路由入方向才加metric
<<<可以用"show ip ospf da rou ad 1.1.1.1"
      Number of TOS metrics: 0
       TOS 0 Metrics: 1
!---确认后,发现R3发送LSA的那个接口地址为"123.1.1.3" 
!---这样只要R3发送的的LSA都会打上这个接口地址为下一跳 
!---这个"1" 是"123.1.1.3"的度量值 
!---看最上面标红的路由Metric: "66 = 1 + 65" 
!---但是如何获得"123.1.1.3"的掩码呢?

R1#sh ip ospf da network      

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

                Net Link States (Area 11)

  Routing Bit Set on this LSA
  LS age: 310
  Options: (No TOS-capability, DC)
  LS Type: Network Links
  Link State ID: 123.1.1.3 (address of Designated Router)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000003
  Checksum: 0xEBA3
  Length: 36
  Network Mask: /24
        Attached Router: 3.3.3.3
        Attached Router: 1.1.1.1
        Attached Router: 2.2.2.2
!---这里看到24就是"123.1.1.3"的掩码,这样下一跳和掩码都有了,路由表中也体现了这些。

Type 4 LSA 存在的价值

既然分析出来了,那么我们也可以分析一下为什么会有Type 4 LSA以及它的存在价值:

R1# sh ip route | i E2
O E2    66.66.66.66 [110/20] via 123.1.1.3, 00:45:59, FastEthernet1/0
!---这回咱们反着推,直接从数据库看"66.66.66.66"

R1#sh ip ospf da ex

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

                Type-5 AS External Link States

  Routing Bit Set on this LSA
  LS age: 959
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 66.66.66.66 (External Network Number )
  Advertising Router: 6.6.6.6
  LS Seq Number: 80000002
  Checksum: 0x4935
  Length: 36
  Network Mask: /32
        Metric Type: 2 (Larger than any link state path)
        TOS: 0
        Metric: 20
        Forward Address: 0.0.0.0
        External Route Tag: 0
!---R6发送的这个LSA,根据上面的理解,找到R6的Type 1 LSA就可以找到下一跳和掩码了 
!---注意,Type 1 LSA只能在存在自己的域中,根据topology,R1为area1,而R6是area0 
!---这时就需要Type 4 LSA出场了 
!---另外还可以看到Metric是20,这是R6发布外部E2路由的度量值

R1#sh ip ospf da asbr-summary 

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

                Summary ASB Link States (Area 11)

  Routing Bit Set on this LSA
  LS age: 1522
  Options: (No TOS-capability, DC, Upward)
  LS Type: Summary Links(AS Boundary Router)
  Link State ID: 6.6.6.6 (AS Boundary Router address)
  Advertising Router: 3.3.3.3
  LS Seq Number: 80000003
  Checksum: 0x9440
  Length: 28
  Network Mask: /0
        TOS: 0  Metric: 65
!---可以看到R6地址由ABR发出,并生成Type 4 LSA 
!---所以可以递归到ABR上,再找R3的Type 1/2,可以参考上面的输出 
!---这里面的65是到R3到R6的开销,那么R1到R6的开销呢? 
!---仍然是20,因为是E2的路由 
!---那么对于R1来说,如果是E1的路由,应该是多少度量值呢? 
!---外部路由的开销+到ASBR的开销+到ABR的开销=20+65+1=86

根据数据库选路由

如果按照上面的做法,R1要到达66.66.66.66,那么首先到达R3。
到了R3后,它在怎么走呢?

R3#sh ip ospf da ex                

            OSPF Router with ID (3.3.3.3) (Process ID 1)

                Type-5 AS External Link States

  Routing Bit Set on this LSA
  LS age: 1034
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 66.66.66.66 (External Network Number )
  Advertising Router: 6.6.6.6
!---如果想知道66.66.66.66,那么首先要知道如何到达6.6.6.6 
!---6.6.6.6达到外部路由的metric在下面以标出20 
!---想知道6.6.6.6的下一跳,就需要Check是否有type 1的信息   LS Seq Number: 80000004
  Checksum: 0xC13B
  Length: 36
  Network Mask: /32
        Metric Type: 1 (Comparable directly to link state metric)
        TOS: 0
        Metric: 20
        Forward Address: 0.0.0.0
        External Route Tag: 0

根据R3的type1的信息(最上面有),发现他只跟R4和R5连接,并且metric都是64。
那么就需要确认谁到6.6.6.6的开销最短?R4和R5?

  LS age: 1555
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 4.4.4.4
  Advertising Router: 4.4.4.4
  LS Seq Number: 80000003
  Checksum: 0x55A4
  Length: 96
  Number of Links: 6

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 6.6.6.6
     (Link Data) Router Interface address: 46.1.1.4
      Number of TOS metrics: 0
       TOS 0 Metrics: 64

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 46.1.1.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 64

  Routing Bit Set on this LSA
  LS age: 1560
  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: 80000003
  Checksum: 0x416F
  Length: 96
  Area Border Router
  AS Boundary Router
  Number of Links: 6

    Link connected to: another Router (point-to-point)
     (Link ID) Neighboring Router ID: 6.6.6.6
     (Link Data) Router Interface address: 56.1.1.5
      Number of TOS metrics: 0
       TOS 0 Metrics: 1

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 56.1.1.0
     (Link Data) Network Mask: 255.255.255.0
      Number of TOS metrics: 0
       TOS 0 Metrics: 1
!---可以看出来R5到达R6的Metric最小,是1 
!---所以R3到达R6的Metric就是64+1 
!---那么就得出R1到达R6的Metric是1+64+1=66 
!---那么到达外部路由就是66+20=86

如果需要查看wireshark中的各类LSA的信息,可以查看我的下一篇总结《CCIE SP-OSPF 小结3-抓包信息

本文出自 Frank's Blog

版权声明:


本文链接:CCIE SP-OSPF 小结2-数据库
版权声明:本文为原创文章,仅代表个人观点,版权归 Frank Zhao 所有,转载时请注明本文出处及文章链接
你可以留言,或者trackback 从你的网站

No Responses to “CCIE SP-OSPF 小结2-数据库”

  1. […] 根据我上一篇文章《CCIE SP-OSPF 小结2-数据库》中的例子,下面列出针对常见LSA的抓包信息: […]

留言哦

blonde teen swallows load.xxx videos