5 Replies Latest reply: May 29, 2019 6:01 AM by Daniel RSS

    Link ID on "show ip ospf database"

    Learner

      Hello all,

       

      I'm trying to make sense of link ID from the output of "show ip ospf database".

       

      Below is a topology that Mr Andre used in his CCNA video class.

       

      I added R5 (area 1) so that R1 can have some inter-area routes. R5 also has its own loopback 10.55.0.0/24 added.

       

      My observation is "Link ID" from the "show ip ospf database" output means different things for different link states.

       

      Link ID is the router-ID of the advertising router in Router Link State.

      Link ID is the interface IP address of the area 0 DR in Net Link States.

      Link ID is the network ID of the external (inter-area) routes in Summary Net Link States.

       

      ospf topology3.jpg

       

       

      R1#

      R1#show ip int br | ex un

      Interface                  IP-Address      OK? Method Status                Protocol

      GigabitEthernet1/0.12      10.1.12.1       YES NVRAM  up                    up

      GigabitEthernet1/0.13      100.1.13.1      YES manual up                    up

      GigabitEthernet1/0.14      10.1.14.1       YES NVRAM  up                    up

      GigabitEthernet1/0.21      10.1.21.1       YES NVRAM  up                    up

      GigabitEthernet3/0         10.15.0.1       YES manual up                    up

      Loopback0                  10.100.1.1      YES manual up                    up


      R1#

      R1#show run | sec ospf

      router ospf 1

      network 10.15.0.0 0.0.0.255 area 1

      network 10.100.1.1 0.0.0.0 area 0

      network 0.0.0.0 255.255.255.255 area 0

      R1#

      R1#

      R1#

      R1#show ip ospf database


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


                      Router Link States (Area 0)


      Link ID         ADV Router      Age        Seq#      Checksum Link count

      2.2.2.2        2.2.2.2         890        0x80000016 0x002BB0 1

      10.1.21.1      10.1.21.1      1591        0x80000024 0x000635 5


      ! Above Link ID is the router-ID of the advertising router.


                      Net Link States (Area 0)


      Link ID        ADV Router      Age        Seq#      Checksum

      10.1.12.2      2.2.2.2         890        0x80000005 0x0013D8


      ! Above Link ID is the interface IP address of the area 0 DR.


                      Summary Net Link States (Area 0)


      Link ID        ADV Router      Age        Seq#      Checksum

      10.15.0.0      10.1.21.1      1430        0x80000001 0x0060A1

      10.55.0.0      10.1.21.1      46          0x80000001 0x008850


      ! Above Link ID is the network ID of the external (inter-area) routes.

      ! Here both 10.15.0.0 and 10.55.0.0 are from Area 1. 


      ! Below it's the same but for Area 1 instead.


                      Router Link States (Area 1)


      Link ID        ADV Router      Age        Seq#       Checksum Link count

      5.5.5.5        5.5.5.5        52          0x80000003 0x00720F 2

      10.1.21.1      10.1.21.1      1256        0x80000008 0x005E56 1


                      Net Link States (Area 1)


      Link ID        ADV Router      Age        Seq#       Checksum

      10.15.0.1      10.1.21.1      1435        0x80000001 0x007356


                      Summary Net Link States (Area 1)


      Link ID        ADV Router      Age        Seq#      Checksum

      10.1.12.0      10.1.21.1      379        0x80000004 0x007E82

      10.1.14.0      10.1.21.1      379        0x80000004 0x006896

      10.1.21.0      10.1.21.1      379        0x80000004 0x001BDC

      10.100.1.1     10.1.21.1      1684       0x80000002 0x004960

      100.1.13.0     10.1.21.1      379        0x80000004 0x00DCC8

      R1#

        • 1. Re: Link ID on "show ip ospf database"
          Steven Davidson

          This is all covered in great detail in RFC 2328 starting here: RFC 2328 - OSPF Version 2

           

          Each LSA is described and the value of the Link ID is also described as it relates to a particular type of LSA.

          • 2. Re: Link ID on "show ip ospf database"
            sarah

            Learner,

             

            The link id part in the show ip ospf database is incorrect, it should say link state ID. This is from Dante's OSPF blog: The specified item was not found.

            All LSAs regardless of type have an LSA header, which identifies important pieces of information about the LSA. For example, the Type-1 Router LSA Header is as follows:

             

            LS age: 36

            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: 0x2B0B


            From top to bottom:

             

            1. The LSA’s age in seconds. Once an LSA reaches Max Age or 3600s, it is removed from the database.
            2. LSA Options that control how OSPF routers treat the LSA
            3. The LSA Type. In this case it is a Type-1 Router LSA
            4. An Identifier for the LSA called the Link State ID. In this case, 1.1.1.1
            5. The router that originally advertised the LSA. Only this router can modify or prematurely remove the LSA from the LSDB. For this LSA, 1.1.1.1 is the advertising router and is the only router that can modify or prematurely age out the LSA.
            6. Sequence number which is used to identify newer copies of an LSA
            7. Checksum that is used to detect corruption in the LSA.


            This header can also be referenced in the show ip ospf database output. The output however refers to the Link State ID as Link ID which is inaccurate. A Link ID identifies a single link whereas a Link State ID identifies an LSA that may contain many links.


            R1#sh ip ospf database

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

                          Router Link States (Area 0)

            Link ID        ADV Router     Age        Seq#      Checksum Link count

            1.1.1.1        1.1.1.1        858        0x80000009 0x00949E 4


            A key topic for understanding is that the Link State ID (or Link ID from the show ip ospf database output) is not an IP address. In the above, the presence of 1.1.1.1 as a Link ID does not mean there is network connectivity to ip address 1.1.1.1/32. Instead, it signals that there is a router node called 1.1.1.1 on the graph in the LSDB.

             

            Have a look at his blog, he details on each LSA and that should help clarify a lot of OSPF related concepts for you.

             

            For eg. regarding the link state ID in the Type 1 LSA:

            When R1 creates its Type-1 Router LSA, it will use its RID (1.1.1.1) as the Link State ID and advertising router field of the LSA header as follows:

             

            R1#show ip ospf database router self-originate

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

                          Router Link States (Area 0)

            LS age: 835

            Options: (No TOS-capability, DC)

            LS Type: Router Links

            Link State ID: 1.1.1.1

            Advertising Router: 1.1.1.1

            • 3. Re: Link ID on "show ip ospf database"
              Gokul

              Hi Sarah,

               

              I just started to have a look at Dante's blog on OSPF graph, LSAs and LSDB. But unfortunately it's no longer available it seems. Do you have any any other DOCs or Blogs that explains well other than RFC.

              • 4. Re: Link ID on "show ip ospf database"
                Martin

                if u really need more info on OSPF database and packets types, u should see Routing TCP/IP book by Doyle Jeff. http://www.ciscopress.com/store/routing-tcp-ip-volume-1-9781587052026

                 

                To fully understand OSPF u need to see Cisco IP Routing: Packet Forwarding and Intra-domain Routing Protocols  By Alex Zinin

                 

                Link ID: Identifies the entity to which the originating router is connected with the described link.

                A type 1 link to describe the adjacency to the other router on the link but only if the adjacency is in the Full state. The Link ID field is set to the Router-ID of the neighboring router. The Link Data field is set to the router's own interface IP address if the link is numbered, or it is set to the IfIndex value—an interface index used in SNMP protocol—associated with this interface if the link is unnumbered. The link metric is set to the cost associated with the interface.

                 

                A type 3 link to announce the IP prefix associated with the interface. This link record is not included if the point-to-point interface is unnumbered. The Link ID field is set to the value of the announced IP prefix. The Link Data field is set to the value of the network mask corresponding to the prefix length. The link metric is set to the cost associated with the interface. Note that a type 3 link is placed into the router-LSA regardless of the state of the adjacency crossing the link.

                 

                type 2 link in its router-LSA, describing a link to a transit network. The Link ID field of the link record is set to the IP address of the DR on the segment. The Link Data field is set to the router's own interface IP address. The link metric is set to the cost associated with the interface. (This link is a reference to the network-LSA originated by the DR.)

                • 5. Re: Link ID on "show ip ospf database"
                  Daniel

                  Hi Learner,

                   

                  OSPF is a very complex routing-protocol to understand. There are many great resources out there to help you with this. As part of my own CCIE-studies i created a couple of documents that may be of interest for this. Just check my uploaded documents for "OSPF".

                   

                  Sarah/Dante is also correct and I agree with them in that it should say Link-STATE ID since OSPF deals with Link-STATES and not ID's.

                   

                  A very short summary of how it all works is that depending on the LSA-type the LSA contains different fields so that every Link-State router can identify a "link-state" in the topology. Then calculate the SPF-algorithm based on it. Link ID may or may not be the interface of the ip-address, it may or may not be the subnet id. It all depends on what it tries to describe.

                   

                  My observation is "Link ID" from the "show ip ospf database" output means different things for different link states.

                   

                  And this is exactly how OSPF should work .

                   

                  -HTH

                  Daniel