Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

missing routes in OSPF Database

Hi,

I have some strange output that the routes I learned from OSPF is indeed in the OSPF Routing table but it is not in the Database table.

For example,

show ip route ospf -- the output will show me the routes

show ip ospf database -- those routes are not in this output

show ip ospf database router -- those routes shows up in this output.

I used to see routes in both routing table and database table.  So is there something changed and we no longer suppose to see the routes in the database anymore?

So I create a quick lab for a simple setup.

i have a 2811 router connects to a layer 3 switch.  A simple OSPF between router and switch so they can exchange routes.  I created a few loopback subnets on the layer 3 switch and advertise in the ospf table.

from router, we can see it learns these routes are follow:

CE-R22-2811#sh ip route ospf
     30.0.0.0/32 is subnetted, 3 subnets
O       30.1.2.1 [110/2] via 5.1.0.69, 00:13:03, FastEthernet0/0
O       30.1.3.1 [110/2] via 5.1.0.69, 00:13:03, FastEthernet0/0
O       30.1.1.1 [110/2] via 5.1.0.69, 00:13:03, FastEthernet0/0

But I don't see it in database:

CE-R22-2811#sh ip ospf database

            OSPF Router with ID (1.0.0.22) (Process ID 50)

                Router Link States (Area 21)

Link ID         ADV Router      Age         Seq#       Checksum Link count
1.0.0.22        1.0.0.22        796         0x80000002 0x005715 1
5.1.0.69        5.1.0.69        1996        0x80000005 0x00D592 4

                Net Link States (Area 21)

Link ID         ADV Router      Age         Seq#       Checksum
5.1.0.69        5.1.0.69        1996        0x80000001 0x002E32

                Type-5 AS External Link States

Link ID         ADV Router      Age         Seq#       Checksum Tag
0.0.0.0         1.0.0.22        423         0x80000001 0x002347 50

But then I see if with the "router" command:

CE-R22-2811#sh ip ospf database router

            OSPF Router with ID (1.0.0.22) (Process ID 50)

                Router Link States (Area 21)

  LS age: 804
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 1.0.0.22
  Advertising Router: 1.0.0.22
  LS Seq Number: 80000002
  Checksum: 0x5715
  Length: 36
  AS Boundary Router
  Number of Links: 1

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


  LS age: 2004
  Options: (No TOS-capability, DC)
  LS Type: Router Links
  Link State ID: 5.1.0.69
  Advertising Router: 5.1.0.69
  LS Seq Number: 80000005
  Checksum: 0xD592
  Length: 72
  Number of Links: 4

    Link connected to: a Stub Network
     (Link ID) Network/subnet number: 30.1.3.1
     (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: 30.1.2.1
     (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: 30.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: 5.1.0.69
     (Link Data) Router Interface address: 5.1.0.69
      Number of TOS metrics: 0
       TOS 0 Metrics: 1

I have other production router similarly but when I do "show ip ospf database", I see all the routes in this output so not sure why some shows and some doesn't.

Reason why I really need to see them in the database is becaues of the following:

My production site has a WAN router peering with 2 Layer 3 switches with ospf on LAN so the router learns all the LAN routes from both Layer 3 switches where we set the ospf cost to prefer SW1 and makes SW2 as backup.

So in the past, if I do "show ip ospf database", I will see the router can see the LAN routers coming from both SW1 and SW2 so I know I am learning from both SWs.  Of course in the routing table only sees the routes from SW1 and that's normal.

So not sure why I no longer can see "any LAN routes" anymore with this same command?  When I unplug the cable between router and SW1, I can see I learn all the LAN routes from SW2 in my routing table so I know the ospf did work and SW2 did advertise the routes.  Just don't understand why I can't see it in database.

My real topology actually has SW3 and SW4 behind SW1 and SW2.  SW1/2 peer ospf with SW3/4.  The LAN routes really comes from SW3/4.

So when i do "show ip ospf database router", then I did see the routes show up but shows up with the tag from SW3/4.  So I know the routes are there but it's just not in the database.

Can it be an IOS version issue that the output are difference now or is there something need to enable in order to see it in the database?

thanks,

Joyce

1 REPLY
Cisco Employee

Re: missing routes in OSPF Database

Joyce,

The output you see here is normal and there is nothing changed in the OSPF behavior or implementation.

The fact is that you are probably not interpreting the output of the show ip ospf database correctly. This command is not supposed to give you the listing of all networks in the OSPF database; rather, it gives you an overview of so-called Link State Advertisements, or LSAs, in your OSPF database that ultimately contain the reachable networks in your topology. These LSAs are of several types, and the IP addressing information is spread among these different LSA types as their attributes.

The show ip ospf database router will show you the contents of the LSA Type 1 (so-called Router-LSA). The LSA1 indicates all object directly connected to the router that generated this LSA1. These can be:

  • A neighboring router over a point-to-point connection (identified by the OSPF RID of the neighbor)
  • A multiaccess transit network (identified by the IP address of the Designated Router in the network)
  • A stub network (identified by its IP address and mask)
  • A virtual link (not interesting right now)

To explain the type of networks, a multiaccess transit network is a multiaccess network (one that allows many routers to be connected to it, like Ethernet) that contains at least two routers. A stub network is a network where there is only a single router. Do not confuse these with stubby areas and alike, these are unrelated.

From this it follows that if there is

  • A network with only end stations, without another OSPF router
  • A loopback
  • A point-to-point link

then the IP network/mask configured on these connections will be visible in the LSA1 only - they are all objects that are in OSPF considered to be directly connected to a router so you must look them up in the show ip ospf database router command.

Another type of LSA is the Network-LSA or LSA2. The LSA2 is used to describe a transit multiaccess network, its IP address and mask, and all the routers connected to it. You may find this a little strange - why a separate LSA2 for a transit multiaccess network? The reason is somewhat involved and relates to the fact that on a large multiaccess network with many routers, it is easier and less memory and CPU intensive for each router to just indicate a connection to the common network in its LSA1 rather than having each of N routers indicate a direct connection to all N-1 routers. You can display the contents of LSA2 using the show ip ospf database network command.

So to sum it up, the set of Network-LSAs or LSA2 will contain the IP networks/masks of all transit multiaccess networks in your area and only those network. For all other network in your topology (point-to-point interfaces, loobpack interfaces, stub end networks), they will be hidden inside Router-LSA or LSA1.

The show ip ospf database command shows you only the summary of all LSAs and their Link-state IDs (unique identifiers which may or may not be related to IP addressing in your network so they are not conclusive) which is Router ID for LSA1 and DR's IP address for LSA2. This may have given you the impression that this command shows you all networks - most certainly, it does not. The individual addressing information is hidden inside these LSAs so if you need to have a detailed look inside the LSA1 or LSA2.

Best regards,

Peter

1962
Views
5
Helpful
1
Replies
CreatePlease login to create content