Search This Blog

Saturday, January 7, 2012

OSPF Database and LSA's


One of the most useful things we can use to troubleshoot or just to understand the topology of routing protocols is to have the ability to look into their databases or tables and to understand what the routing protocol see and learn and which information he is holding.

OSPF protocol exchange information with his adjacent neighbors using LSA, which stands for Link-State Advertisement. While exchanging LSA’s OSPF is building an LSDB – Link-State Database, which holds all the relevant information which allow OSPF to take routing decisions based on this information.

Each router, in the OSPF AS, is holding an LSDB which relevant and organized from his point of view and the SFP algorithm is applied on the LSDB to choose the shortest path available according to this database.

So following the network topology, in my last post, let’s run some show commands:

R3#show ip ospf database

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

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
2.2.2.2         R2              1197        0x80000035 0x00C1C0 2
3.3.3.3         R3              867         0x80000035 0x0030CC 3
4.4.4.4         R4              530         0x8000003A 0x00CC15 3
5.5.5.5         R5              2     (DNA) 0x80000003 0x00C8E4 1

                Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
10.1.23.3       R3              867         0x80000032 0x0003C0
10.1.34.3       R3              1364        0x8000002E 0x00F5BE

                Summary Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
1.1.1.1         R2              1197        0x80000032 0x002BC9
5.5.5.5         R4              530         0x8000002A 0x00469E
5.5.5.5         R5              22    (DNA) 0x80000001 0x0016FD
6.6.6.6         R5              22    (DNA) 0x80000001 0x004CB9
10.1.12.0       R2              1198        0x80000032 0x003CA6
10.1.45.0       R4              1775        0x8000002F 0x009923
10.1.45.0       R5              22    (DNA) 0x80000001 0x00D70F
10.1.56.0       R5              22    (DNA) 0x80000001 0x005E7D
192.168.0.0     R2              1198        0x8000002A 0x00D5F7

                Summary ASB Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
5.5.5.5         R4              532         0x8000002A 0x002EB6
6.6.6.6         R5              22    (DNA) 0x80000001 0x0034D1

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
172.16.0.0      R6              1436        0x80000029 0x00CFEB 999
172.16.4.0      R6              1436        0x80000032 0x001F77 0
172.25.0.0      R5              396         0x80000029 0x00EBB9 0

Displays a quick summary of the LSDB for OSPF router with ID 3.3.3.3 (which is R3 in this case).
The first section, Router Link States (Area 0), refer to LSA type 1 – self-originated links which represent all interfaces in this area, we can also notice the virtual-link from R5 with a DNA (Do Not Age) notification.
The second section, Net Link States (Area 0, LSA type 2 refer to interfaces advertised by the DR in this segment.
The third section, Summary Net Link States (Area 0), LSA type 3 - refer to subnets and interfaces, from other areas, advertised by the ABR into that area.
Forth section, Summary ASB Link States (Area 0), LSA type 4 - point a route to reach an ASBR
The fifth section, Type-5 AS External Link States, refer to LSA type 5, created by an ASBR, for external routes injected into the OSPF domain.

Running the same command, sh ip ospf database, on R6 will result in the following output:

R6#sh ip ospf database

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

                Router Link States (Area 6)

Link ID         ADV Router      Age         Seq#       Checksum Link count
5.5.5.5         R5              6           0x8000003E 0x0065C4 1
6.6.6.6         R6              5           0x80000038 0x00AB53 2

                Net Link States (Area 6)

Link ID         ADV Router      Age         Seq#       Checksum
10.1.56.6       R6              0           0x80000034 0x00BCB6

                Summary Net Link States (Area 6)

Link ID         ADV Router      Age         Seq#       Checksum
1.1.1.1         R5              12          0x8000002B 0x00B11A
2.2.2.2         R5              12          0x8000002B 0x001FB2
3.3.3.3         R5              12          0x8000002B 0x008C4B
4.4.4.4         R5              12          0x8000002B 0x00F9E3
5.5.5.5         R5              12          0x8000002B 0x00677C
10.1.12.0       R5              12          0x8000002B 0x00C2F6
10.1.23.0       R5              12          0x8000002B 0x00E4D3
10.1.34.0       R5              14          0x8000002B 0x0007B0
10.1.45.0       R5              14          0x8000002B 0x00298D
192.168.0.0     R5              14          0x8000002C 0x004A51

                Type-7 AS External Link States (Area 6)

Link ID         ADV Router      Age         Seq#       Checksum Tag
172.16.0.0      R6              337         0x80000001 0x00B809 999
172.16.4.0      R6              337         0x80000001 0x001A8B 0
172.25.0.0      R5              13          0x80000001 0x0020AB 0

Note that no LSA type 4 or 5 are exist due to the fact that area 6 has been configured, on R5 and R6, as NSSA area which allows only LSA type 1, 2,3 and 7.
LSA type 7 are much like LSA type 5 (injected external routes) with a difference that they are injected into an NSSA area, which doesn’t allow LSA type 5 so they are converted to type 7.

R5#show ip ospf database adv-router 4.4.4.4 allows us to see all LSA’s advertised by router R4 (router-id 4.4.4.4):
5#show ip ospf database adv-router 4.4.4.4

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

                Router Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum Link count
4.4.4.4         R4              1     (DNA) 0x80000011 0x001FEB 3

                Summary Net Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
5.5.5.5         R4              216   (DNA) 0x80000001 0x009875
10.1.45.0       R4              1052  (DNA) 0x80000006 0x00EBF9

                Summary ASB Link States (Area 0)

Link ID         ADV Router      Age         Seq#       Checksum
5.5.5.5         R4              216   (DNA) 0x80000001 0x00808D

                Router Link States (Area 5)

Link ID         ADV Router      Age         Seq#       Checksum Link count
4.4.4.4         R4              719         0x8000003C 0x000150 1
         
                Net Link States (Area 5)

Link ID         ADV Router      Age         Seq#       Checksum
10.1.45.4       R4              719         0x8000002B 0x00AEF0
<OUTPUT OMMITTED>

Show ip ospf database network allows us to see all LSA type 2 (advertised by DR’s), for all areas connected to this router, with much more details such the DR identity, the attached routers to this link, the subnet mask and the advertising router. 

R5#show ip ospf database network

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

                Net Link States (Area 0)

  Routing Bit Set on this LSA
  LS age: 919 (DoNotAge)
  Options: (No TOS-capability, DC)
  LS Type: Network Links
  Link State ID: 10.1.23.3 (address of Designated Router)
  Advertising Router: R3
  LS Seq Number: 80000009
  Checksum: 0x5597
  Length: 32
  Network Mask: /24
        Attached Router: 3.3.3.3
        Attached Router: 2.2.2.2

  Routing Bit Set on this LSA
  LS age: 1175 (DoNotAge)
  Options: (No TOS-capability, DC)
  LS Type: Network Links
  Link State ID: 10.1.34.3 (address of Designated Router)
  Advertising Router: R3
  LS Seq Number: 80000005
  Checksum: 0x4895
  Length: 32
  Network Mask: /24
        Attached Router: 3.3.3.3
        Attached Router: 4.4.4.4


                Net Link States (Area 5)

  Routing Bit Set on this LSA
  LS age: 858
  Options: (No TOS-capability, DC)
  LS Type: Network Links
  Link State ID: 10.1.45.4 (address of Designated Router)
  Advertising Router: R4
  LS Seq Number: 8000002B
  Checksum: 0xAEF0
  Length: 32
  Network Mask: /24
        Attached Router: 4.4.4.4
        Attached Router: 5.5.5.5


                Net Link States (Area 6)

  Routing Bit Set on this LSA
  LS age: 479
  Options: (No TOS-capability, DC)
  LS Type: Network Links
  Link State ID: 10.1.56.6 (address of Designated Router)
  Advertising Router: R6
  LS Seq Number: 80000034
  Checksum: 0xBCB6
  Length: 32
  Network Mask: /24
        Attached Router: 6.6.6.6
        Attached Router: 5.5.5.5

Show ip ospf database external will displays all external routes with their relevant information. Note summary prefix 172.16.0.0/22, which has been tagged by R6 in the previous post, is also appear here.

R4#sh ip ospf database external

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

                Type-5 AS External Link States

  Routing Bit Set on this LSA
  LS age: 930
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 172.16.0.0 (External Network Number )
  Advertising Router: R5
  LS Seq Number: 80000001
  Checksum: 0x6B64
  Length: 36
  Network Mask: /22
        Metric Type: 2 (Larger than any link state path)
        TOS: 0
        Metric: 20
        Forward Address: 6.6.6.6
        External Route Tag: 999

  Routing Bit Set on this LSA
  LS age: 930
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 172.16.4.0 (External Network Number )
  Advertising Router: R5
  LS Seq Number: 80000001
  Checksum: 0xCCE6
  Length: 36
  Network Mask: /24
        Metric Type: 2 (Larger than any link state path)
        TOS: 0
        Metric: 20
        Forward Address: 6.6.6.6
        External Route Tag: 0

  Routing Bit Set on this LSA
  LS age: 955
  Options: (No TOS-capability, DC)
  LS Type: AS External Link
  Link State ID: 172.25.0.0 (External Network Number )
  Advertising Router: R5
  LS Seq Number: 8000002A
  Checksum: 0xE9BA
  Length: 36
  Network Mask: /21
        Metric Type: 2 (Larger than any link state path)
        TOS: 0
        Metric: 20
        Forward Address: 0.0.0.0
        External Route Tag: 0

No comments:

Post a Comment