CCIE Pursuit Blog

November 17, 2008

Cool Command 3: show ip ospf database database-summary

‘show ip ospf database’ is one of those commands that every CCIE candidate needs to know how to use as it can show you a ton of very good OSPF information.  There are a ton of options for this command:

r2#show ip ospf database ?
  adv-router        Advertising Router link states
  asbr-summary      ASBR summary link states
  database-summary  Summary of database
  external          External link states
  network           Network link states
  nssa-external     NSSA External link states
  opaque-area       Opaque Area link states
  opaque-as         Opaque AS link states
  opaque-link       Opaque Link-Local link states
  router            Router link states
  self-originate    Self-originated link states
  summary           Network summary link states
  |                 Output modifiers
  <cr>

I can’t believe that I’ve gotten this far and never used the “database-summary” option for this command. 

database-summary
 (Optional) Displays how many of each type of LSA for each area there are in the database, and the total.

Here’s the output of the command for an OSPF process with area 0 and three non-zero areas (note the difference in the LSA types in Area 0 versus the non-zero areas):

r1#show ip ospf database database-summary

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

Area 0 database summary
  LSA Type      Count    Delete   Maxage
  Router        2        0        0      
  Network       1        0        0      
  Summary Net   6        0        0      
  Summary ASBR  0        0        0      
  Type-7 Ext    0        0        0      
    Prefixes redistributed in Type-7  0
  Opaque Link   0        0        0      
  Opaque Area   0        0        0      
  Subtotal      9        0        0      

Area 100 database summary
  LSA Type      Count    Delete   Maxage
  Router        1        0        0      
  Network       0        0        0      
  Summary Net   8        0        0      
  Summary ASBR  0        0        0      
  Type-7 Ext    0        0        0      
    Prefixes redistributed in Type-7  0
  Opaque Link   0        0        0      
  Opaque Area   0        0        0      
  Subtotal      9        0        0      

Area 101 database summary
  LSA Type      Count    Delete   Maxage
  Router        1        0        0      
  Network       0        0        0      
  Summary Net   8        0        0      
  Summary ASBR  0        0        0      
  Type-7 Ext    0        0        0      
    Prefixes redistributed in Type-7  0
  Opaque Link   0        0        0      
  Opaque Area   0        0        0      
  Subtotal      9        0        0      

Area 102 database summary
  LSA Type      Count    Delete   Maxage
  Router        1        0        0      
  Network       0        0        0      
  Summary Net   8        0        0      
  Summary ASBR  0        0        0      
  Type-7 Ext    0        0        0      
    Prefixes redistributed in Type-7  0
  Opaque Link   0        0        0      
  Opaque Area   0        0        0      
  Subtotal      9        0        0      

Process 100 database summary
  LSA Type      Count    Delete   Maxage
  Router        5        0        0      
  Network       1        0        0      
  Summary Net   30       0        0      
  Summary ASBR  0        0        0      
  Type-7 Ext    0        0        0      
  Opaque Link   0        0        0      
  Opaque Area   0        0        0      
  Type-5 Ext    0        0        0      
      Prefixes redistributed in Type-5  0
  Opaque AS     0        0        0      
  Total         36       0        0

As you can see this command shows a count of each type of LSA for each OSPF area (per process if you’re running multiple processes).  You can limit the output to a specific area (or process) with a grep command:

Show just the database-summary for area 0:

r2#show ip ospf database database-summary | sec Area 0
Area 0 database summary
  LSA Type      Count    Delete   Maxage
  Router        2        0        0      
  Network       1        0        0      
  Summary Net   6        0        0      
  Summary ASBR  0        0        0      
  Type-7 Ext    0        0        0      
    Prefixes redistributed in Type-7  0
  Opaque Link   0        0        0      
  Opaque Area   0        0        0      
  Subtotal      9        0        0 

Show just the database-summary for Process 100:

r2#show ip ospf database database-summary | sec Process 100
Process 100 database summary
  LSA Type      Count    Delete   Maxage
  Router        5        0        0      
  Network       1        0        0      
  Summary Net   30       0        0      
  Summary ASBR  0        0        0      
  Type-7 Ext    0        0        0      
  Opaque Link   0        0        0      
  Opaque Area   0        0        0      
  Type-5 Ext    0        0        0      
      Prefixes redistributed in Type-5  0
  Opaque AS     0        0        0      
  Total         36       0        0

March 27, 2008

Cool Command 2: Verify Your BGP Regular Expressions

Here’s a great command for verifying (or just practicing) your BGP regular expression filters.  In the example below, I want to only see the routes where AS54 is the last AS in the AS path*.  I’m pretty sure that my regular expression is correct, but I want to verify it by running it against my BGP database.

Here’s the full BGP database:

r6(config)#do sh ip bgp | b Netw
   Network          Next Hop            Metric LocPrf Weight Path
*> 28.119.16.0/24   204.12.1.254             0             0 54 i
*> 28.119.17.0/24   204.12.1.254             0             0 54 i
*> 112.0.0.0        54.1.3.254               0             0 54 50 60 i
*> 113.0.0.0        54.1.3.254               0             0 54 50 60 i
*> 114.0.0.0        54.1.3.254               0             0 54 i
*> 115.0.0.0        54.1.3.254               0             0 54 i
*> 116.0.0.0        54.1.3.254               0             0 54 i
*> 117.0.0.0        54.1.3.254               0             0 54 i
*> 118.0.0.0        54.1.3.254               0             0 54 i
*> 119.0.0.0        54.1.3.254               0             0 54 i
*> 205.90.31.0      204.12.1.3                             0 200 254 ?
*> 220.20.3.0       204.12.1.3                             0 200 254 ?
*> 222.22.2.0       204.12.1.3                             0 200 254 ?

Here’s the results of filtering with ^54_ :

r6(config)#do sh ip bgp regex ^54_
BGP table version is 14, local router ID is 150.1.6.6
Status codes: s suppressed, d damped, h history, * valid, > best, i – internal,
              r RIB-failure, S Stale
Origin codes: i – IGP, e – EGP, ? – incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*> 28.119.16.0/24   204.12.1.254             0             0 54 i
*> 28.119.17.0/24   204.12.1.254             0             0 54 i
*> 112.0.0.0        54.1.3.254               0             0 54 50 60 i
*> 113.0.0.0        54.1.3.254               0             0 54 50 60 i
*> 114.0.0.0        54.1.3.254               0             0 54 i
*> 115.0.0.0        54.1.3.254               0             0 54 i
*> 116.0.0.0        54.1.3.254               0             0 54 i
*> 117.0.0.0        54.1.3.254               0             0 54 i
*> 118.0.0.0        54.1.3.254               0             0 54 i
*> 119.0.0.0        54.1.3.254               0             0 54 i

show ip bgp regexp

*Thanks to apep for the correction.  See comment section for details.

March 24, 2008

Cool Command 1: Verify OSPF Authentication

Here’s a nice command to quickly verify that your OSPF authentication is enabled:

r5#sh ip os int | i proto|auth|Area
OSPF_VL0
is up, line protocol is up
  Internet Address 191.1.45.5/25, Area 0
  Message digest authentication enabled
Loopback0 is up, line protocol is up
  Internet Address 150.1.5.5/24, Area 0
Serial0/0 is up, line protocol is up
  Internet Address 191.1.125.5/24, Area 0
  Message digest authentication enabled
FastEthernet0/0
is up, line protocol is up
  Internet Address 191.1.5.5/24, Area 5
  Simple password authentication enabled
FastEthernet0/1.45
is up, line protocol is up
  Internet Address 191.1.45.5/25, Area 45
  Simple password authentication enabled
FastEthernet0/1.59
is up, line protocol is up
  Internet Address 191.1.59.5/24, Area 90
FastEthernet0/1.50 is up, line protocol is up
  Internet Address 191.1.50.5/24, Area 90

This command shows us all of the OSPF enabled interfaces, what area they are they are in, whether they are using authentication or not, and – if so – what type of authentication we are using.

For example, we can see that s0/0 is OSPF enabled, is in area 0, is running authentication, and the authentication type is md5.

ip ospf authentication

ip ospf authentication-key

ip ospf message-digest-key

area authentication  

show ip ospf interface

Blog at WordPress.com.