Viewing the OSPF Link-State Database

Problem

You want to look at the routers link-state database to make sure that all the OSPF routers know about each other.

Solution

Use the show ospf database command to view the contents of the link-state database:

aviva@RouterG> show ospf database OSPF link state database, area 0.0.0.0 Type ID Adv Rtr Seq Age Opt Cksum Len Router 192.168.17.1 192.168.17.1 0x800000d0 986 0x2 0xebd2 60 Router 192.168.18.1 192.168.18.1 0x80000083 986 0x2 0xbd4a 60 Router *192.168.19.1 192.168.19.1 0x8000009f 656 0x2 0x46a5 60 Network *10.0.0.1 192.168.19.1 0x80000010 56 0x2 0x9b2e 32 Network *10.0.1.2 192.168.19.1 0x80000030 356 0x2 0x5353 32 Network 10.0.2.1 192.168.18.1 0x80000005 1454 0x2 0x993b 32

Discussion

OSPF routers exchange LSAs that describe that routers view of the network topology, and the routers store the LSAs in a link-state database. The SPF algorithm then runs on the link-state database to create the OSPF routing table, which contains the shortest path to each destination.

Use the show ospf database command to look at the OSPF LSAs in the link-state database. Table 12-1 explains the different types OSPF LSAs.

Table 12-1. OSPF LSA types

Type

Name

Description

1

Router

All routers originate these LSAs, flooding them within a single area, to describe the state and cost of router interfaces within the area.

2

Network

DRs originate these LSAs, flooding them within a single area, to describe all routers attached to the network, including the DR.

3

Summary (network)

ABRs originate a single Summary LSA for each known interarea destination, flooding them within a single domain. Type 3 Summary LSAs are sent when the destination is an IP network.

4

Summary (ASBR)

ABRs originate a single Summary LSA for each known interarea destination, flooding them within a single domain. Type 4 summary LSAs are sent when the destination is an ASBR.

5

AS External

ASBRs originate these LSAs to describe destinations external to the OSPF domain (AS).

7

NSSA External

NSSA ASBRs originate these LSAs, flooding them within the NSSA, to describe destinations in the other parts of the OSPF domain.

In the command output in this recipe, the database has three Router (Type 1) and three Network (Type 2) LSAs. The lines with an asterisk in the ID are database entries that originated from the local router. The router also knows about its two neighbors, 192.168.17.1 and 192.168.18.1, and about the subnetwork that connects these two neighbors (10.0.2.1).

If you check on the other two routers in the area, you see that they have identical databases:

aviva@RouterJ> show ospf database OSPF link state database, area 0.0.0.0 Type ID Adv Rtr Seq Age Opt Cksum Len Router *192.168.17.1 192.168.17.1 0x8000010a 170 0x2 0x760e 60 Router 192.168.18.1 192.168.18.1 0x800000ae 377 0x2 0x6775 60 Router 192.168.19.1 192.168.19.1 0x80000007 372 0x2 0xdf32 48 Network 10.0.0.1 192.168.19.1 0x80000002 372 0x2 0xb720 32 Network 10.0.1.2 192.168.19.1 0x80000002 378 0x2 0xaf25 32 Network 10.0.2.1 192.168.18.1 0x8000002a 481 0x2 0x4f60 32 aviva@RouterH> show ospf database OSPF link state database, area 0.0.0.0 Type ID Adv Rtr Seq Age Opt Cksum Len Router 192.168.17.1 192.168.17.1 0x8000010a 45 0x2 0x760e 60 Router *192.168.18.1 192.168.18.1 0x800000ae 250 0x2 0x6775 60 Router 192.168.19.1 192.168.19.1 0x80000007 247 0x2 0xdf32 48 Network 10.0.0.1 192.168.19.1 0x80000002 247 0x2 0xb720 32 Network 10.0.1.2 192.168.19.1 0x80000002 251 0x2 0xaf25 32 Network *10.0.2.1 192.168.18.1 0x8000002a 354 0x2 0x4f60 32

The only thing different is which LSAs are marked as originated from the router.

Use the following version of the show ospf database command to get a quick summary of the entries LSA database:

aviva@RouterG> show ospf database summary Area 0.0.0.0: 3 Router LSAs 3 Network LSAs Externals: Interface fe-0/0/1.0: Interface fe-1/0/0.0:

Категории