OSPF Operational Commands

OSPF Show Commands

OSPF Summary

Displays the OSPF protocol summary information.

Syntax:

show ospf summary <options>

Option Description

-

Without any option, the command displays the information for all instances.

instance <instance-name>

OSPF summary information for the given instance.

Example: OSPF summary for the default instance

supervisor@rtbrick>SPINE01: op> show ospf summary
Global Information:
  Neighbor State Information:
    Full       : 5
    Loading    : 0
    Exchange   : 0
    ExStart    : 0
    TwoWay     : 0
    Init       : 0
    Attempt    : 0
    Down       : 0
Instance: default
  General information:
    Router ID: 192.168.0.10, Area count: 1, Flood interval: 1000ms
    Opaque capability: True, Segment routing capability: True
    Flags: -|-|-|-|-, Cost: 10000
    SPF initial delay: 50ms, SPF short delay: 200ms, SPF long delay: 5000ms
  Area: 198.51.100.0
    Interface count: 7
      Interface: ifl-0/0/0/1
        Address: 198.51.100.85, State: Backup, Type: broadcast, Priority: 1
        Designated router: 198.51.100.0, Backup designated router: 198.51.100.1
        Hello interval: 10 sec, Dead interval: 40 sec
        Cost: 10000, MTU: 1500
      Interface: ifl-0/0/0/100
        Address: 198.51.100.86, State: P2P, Type: p2p, Priority: 1
        Designated router: 198.51.100.101, Backup designated router: 198.51.100.2
        Hello interval: 10 sec, Dead interval: 40 sec
        Cost: 20000, MTU: 1500
      Interface: ifl-0/0/1/1
        Address: 198.51.100.87, State: P2P, Type: p2p, Priority: 1
        Designated router: 198.51.100.102, Backup designated router: 198.51.100.3
        Hello interval: 10 sec, Dead interval: 40 sec
        Cost: 40000, MTU: 1500
<...>

OSPF Interface

Displays OSPF interface information.

Syntax:

show ospf interface <options>

Option Description

-

Without any option, the command displays the interface information for all instances.

detail

Displays the detailed interface information.

interface <interface-name> detail

Displays detailed information for the specified interface.

instance <instance-name>

OSPF interface information for the given instance.

instance <instance-name> detail

Displays detailed information for the given instance.

instance <instance-name> <interface-name>

Displays information for a specified interface for a given instance.

Example 1: OSPF interface information for the default instance

supervisor@rtbrick>SPINE01: op> show ospf interface
Instance: default
Interface     Area           IP Address     State    Type      Cost   Priority DR          BDR              MTU
ifl-0/0/0/1   0.0.0.0        198.51.100.85  BDR   broadcast  10000  1    198.51.100.27 198.51.100.85     1500
ifl-0/0/0/100 0.0.0.0        198.51.100.77  P2P      p2p        20000  1    198.51.100.0  198.51.100.0      1500
lo-0/0/0/1    0.0.0.0        198.51.100.15  P2P      p2p        10000  1    198.51.100.0  198.51.100.0      1500

Example 2: OSPF interface detailed information

supervisor@rtbrick>SPINE01: op> show ospf interface ifl-0/0/1/100 detail
Instance: default
  Interface: ifl-0/0/1/100, Area: 0.0.0.1
    State: DR, Type: broadcast, Primary IPv4: 56.0.1.6, Router priority: 1
    Designated router: 56.0.1.6, Backup designated router: 56.0.1.5
    Hello interval: 10, Router dead interval: 40, Wait timer: 40
    Metric: 10000, IPv4 MTU: 1500, Auth profile: MD5_1, Auth Key: 1
    Capabilities: *|O|-|-|-|-|E|*
    Received messages:
      Hello: 661, Data descriptor: 13, LS request: 2
      LS update: 152, LS acknowledgement: 78
    Sent messages:
      Hello: 663, Data descriptor: 14, LS request: 3
      LS update: 96, LS acknowledgement: 90
supervisor@rtbrick>SPINE01: op>

OSPF Neighbor

Displays OSPF neighbor information.

Syntax:

show ospf neighbor <options>

Option Description

-

Without any option, the command displays the neighbor information for all instances.

instance <instance-name>

OSPF neighbor information for the given instance.

detail

Displays the detailed neighbor information.

interface <interface-name>

Displays the neighbor information for a specified interface.

instance <instance-name> detail

Displays detailed OSPF neighbor information for the given instance.

instance <instance-name> interface <interface-name>

Displays OSPF neighbor information for the specified interface for the given instance.

instance <instance-name> interface <interface-name> detail

Displays detailed OSPF neighbor information for the specified interface for the given instance.

interface <interface-name> detail

Displays detailed neighbor information for a specified interface.

log

Logs neighbor event information.

log instance <instance-name>

Logs neighbor event information for the specified instance.

log neighbor <neighbor-address>

Logs neighbor event information for the specified neighbor.

Example 1: OSPF neighbor information for the default instance

supervisor@rtbrick>SPINE01: op> show ospf neighbor
Instance: default
Address        Interface    Router ID      Area         State  Priority  DR        BDR            Uptime          Expires
198.51.100.27 ifl-0/0/0/1   198.51.100.20  0.0.0.0      Full  1   198.51.100.27  198.51.100.85  0d:01h:31m:57s  38 Seconds
198.51.100.4  ifl-0/0/0/100 198.51.100.20  0.0.0.0      Full  1   198.51.100.0   198.51.100.0   0d:01h:32m:36s  39 Seconds

Example 2: OSPF neighbor event log information

supervisor@rtbrick>SPINE01: op> show ospf neighbor log
Instance: default, Neighbor router ID: 198.51.100.20
    Sequence number: 143, Interface: ifl-0/0/0/1, Neighbor interface address: 198.51.100.27
    Current state: Full, Next state: Full, Event: Adjacency ok
    DD flags: -|-|-|-
Instance: default, Neighbor router ID: 198.51.100.20
    Sequence number: 142, Interface: ifl-0/0/0/1, Neighbor interface address: 198.51.100.27
    Current state: Full, Next state: Depends, Event: Adjacency ok
    DD flags: -|-|-|-

<...>

OSPF Database

Displays information from OSPF link-state database that contains data about link-state advertisements (LSAs).

Syntax:

show ospf database <options>

Option Description

advertising-router <router-id>

Displays LSDB information for the specified advertising router.

advertising-router <router-id> detail

Displays the detailed LSDB information for the specified advertising router.

advertising-router <router-id> ls-id <ls-id>

Displays the LSDB information for the specified link-state ID for the advertising router.

advertising-router <router-id> ls-type external

Displays the LSDB information for the specified LSA type for the advertising router. Link-state advertisement type includes external, network, router, and summary.

detail

Displays detailed information from LSDB.

instance <instance-name>

Displays OSPF database information for the given instance.

ls-id <ls-id>

OSPF database information for a specific link-state identifier.

ls-type <type>

OSPF database information for the specified link-state type. Link-state advertisement type includes external, network, router and summary.

area <area-id>

Displays database information for the specified OSPF area.

area <area-id> advertising-router <router-id>

Displays LSDB information for the specified advertising router for a specified OSPF area.

area <area-id> detail

Displays detailed LSDB information for the specified OSPF area.

area <area-id> ls-id <ls-id>

Displays LSDB information for the specified link-state identifier for the specified OSPF area.

area <area-id> ls-type <type>

Displays LSDB information for the specified link-state type for the specified OSPF area. Link-state advertisement type includes external, network, router, and summary.

instance <instance-name> advertising router <router-id>

Displays LSDB information for the specified advertising router for the given instance.

instance <instance-name> area <area-id>

Displays LSDB information for the specified area for the given instance.

instance <instance-name> ls-id <ls-id>

Displays LSDB information for the specified link-state identifier for the given instance.

instance <instance-name> ls-type <type>

Displays LSDB information for the specified type of the given instance. Link-state advertisement type includes external, network, router and summary.

Example 1: OSPF database information for the default instance

supervisor@rtbrick>SPINE01: cfg> show ospf database
Instance: default, Area: 0.0.0.0
  Type            Link State ID   Advertising Router   Age     Sequence     Checksum     Cost   Link Count
  Router          198.51.100.15   198.51.100.15         71      0x80000009     0x7cb6        -      4
  Router          198.51.100.20   198.51.100.20         57      0x8000000a     0x2f7d        -      4
  Network         198.51.100.27   198.51.100.20         329     0x80000004     0x7e5c        -      2
  Summary-Network 198.51.100.65   198.51.100.20         374     0x80000004     0xbc36    15000      -
  Summary-Network 198.51.100.22   198.51.100.20         374     0x80000004     0x7aae    10000      -
  Summary-Asbr    198.51.100.32   198.51.100.20         324     0x80000004     0xe7aa    30000      -
Instance: default
  Type            Link State ID   Advertising Router    Age      Sequence     Checksum    Cost    Link Count
  External        198.50.100.53   198.51.100.32         374      0x80000004    0xba29     16777214   -

Example 2: OSPF database detailed information

supervisor@rtbrick>SPINE01: cfg> show ospf database detail
Instance: default, Area: 0.0.0.0 LSAs
  LSA ID: 198.51.100.15
    Advertising router: 198.51.100.15, LSA type: Router
    Sequence number: 0x8000000f, Checksum: 0x1831, LSA age: 1671
    Length: 132, Options: *|-|-|-|-|-|E|*, Flags: -|-|-|-
    Number of links: 9
      Link ID: 198.51.100.20
        Link data: 198.51.100.30, Type: P2P
        Type of service: 0, Metric: 20000
      Link ID: 198.51.100.15
        Link data: 255.255.255.252, Type: Stub
        Type of service: 0, Metric: 20000
<...>

Example 3: OSPF database for an advertising router

supervisor@rtbrick>SPINE01: cfg> show ospf database advertising-router 198.51.100.15
Instance: default, Area: 0.0.0.0
  Type       Link State ID   Advertising Router   Age    Sequence   Checksum     Cost  Link Count
  Router     198.51.100.15    198.51.100.15         690    0x80000009 0x7cb6        -          4

OSPF SPF

Displays SPF results and event logs.

Syntax:

show ospf spf <options>

Option Description

result

Displays the SPF result of all instances.

result area <area-id>

Displays SPF result for the specified area.

result instance <instance-name>

Name of the instance

result node-id <node-id>

Displays SPF result for the specified node identifier.

result area <area-id> <node-id>

Displays SPF result for the specified node identifier for a specified area.

result instance <instance-name> area <area-id>

Displays SPF result for the specified area for a given instance.

result instance <instance-name> node-id <node-id>

Displays SPF result for the specified node identifier for a given instance.

log

Displays SPF event logs for all instances.

log instance <instance-name>

Displays SPF event logs for the specified instance.

Example 1: OSPF SPF Result for the default instance

supervisor@rtbrick>SPINE01: op> show ospf spf result
Instance: default, Area: 0.0.0.0
Node ID       Type     Cost     Advertising Router  Flags      Neighbor Node     Interface      Nexthop
198.51.100.27 NETWORK  10000    198.51.100.20       -|-|-|-    -                 local          -
198.51.100.15 ROUTER   0        198.51.100.15       -|-|-|-    -                 local          -
198.51.100.20 ROUTER   10000    198.51.100.20       -|-|-|B    198.51.100.20     ifl-0/0/0/1    198.51.100.27
                                                               198.51.100.20     ifl-0/0/0/100  198.51.100.4

Example 2: OSPF SPF Result for the specified node identifier for the given area

supervisor@rtbrick>SPINE01: op> show ospf spf result area 0.0.0.0 node-id 198.51.100.27
Instance: default, Area: 0.0.0.0
Node ID        Type      Cost     Advertising Router    Flags     Neighbor Node    Interface    Nexthop
198.51.100.27  NETWORK   10000    198.51.100.20         -|-|-|-    -               local        -

Example 3: OSPF SPF Event Logs

supervisor@rtbrick>SPINE01: op> show ospf spf log
Instance: default, Router ID: 198.51.100.20
    Sequence number: 25, Area ID: 0.0.0.0, LSA type: Network
    Reason: Network LSA change, Back off timer: 5000, LSA count: 1
    LS ID: 198.51.100.20, Schedule timestamp: 2023-11-02 06:58:20, Number of schedule request: 1
    SPF start time: 2023-11-02 06:58:25, Number of nodes: 7, Number of links: 22
    Number of stub links: 12, SPF calculation time: 21us , SPF run time: 159us
    Router LSA change count: 23, Network LSA change count: 6
    Route information change: -

OSPF Route

Displays OSPF routing table information.

Syntax:

show ospf route <options>

Option Description

-

Without any option, the command displays the OSPF route information for all instances.

instance <instance-name>

OSPF route information for the given instance.

instance <instance-name> <afi>

Displays OSPF route information for the specified address family and instance. The supported AFI value is IPv4.

instance <instance-name> AFI <ipv4> <unicast | labeled-unicast>

Displays OSPF route information for the specified SAFI for a specified address family.

instance <instance-name> label <label>

Displays OSPF route information for the specified label and instance.

instance <instance-name> mpls unicast label <label> | type <type>

Displays OSPF route information for the specified MPLS unicast label or type for the instance.

prefix <ip>

Displays OSPF route information for the specified match prefix.

type

Displays information for OSPF route type. The route types include external-type-1, external-type-2, inter-area, intra-area, and ospf-direct.

ipv4 prefix <ip>

Displays OSPF route information for the specified IPv4 prefix.

label <label>

Displays information about the OSPF-labeled routes.

mpls unicast <label | type>

Displays information about OSPF MPLS routes.

area-border

Displays the OSPF Area Border Router (ABR) information. Refer to section "3.1.7. OSPF Route ABR" for the interface configuration details.

autonomous-system-boundary

Displays Autonomous System Border Router information. Refer to section "3.1.7. OSPF Route ABR" for the interface configuration details.

Example: OSPF route information for the default instance

supervisor@rtbrick>SPINE01: op> show ospf route
Instance: default, AFI: ipv4, SAFI: unicast
  Prefix            Area              Type           Cost    Next Hop        Interface
  12.0.0.0/24       0.0.0.0           ospf-direct    10000   n/a             local
  12.1.0.0/24       0.0.0.0           ospf-direct    10000   n/a             local
  24.0.1.0/24       0.0.0.0           inter-area     25000   198.51.100.27   ifl-0/0/0/1
                                                             198.51.100.4    ifl-0/0/0/100
  24.1.1.0/24       0.0.0.0           inter-area     20000   198.51.100.27   ifl-0/0/0/1
                                                             198.51.100.4    ifl-0/0/0/100
  25.0.1.0/24       0.0.0.0           inter-area     35000   198.51.100.27   ifl-0/0/0/1
                                                             198.51.100.4    ifl-0/0/0/100
  198.51.100.15/32  0.0.0.0           ospf-direct    10000   n/a             local
  198.51.100.20/32  0.0.0.0           intra-area     20000   198.51.100.27   ifl-0/0/0/1

OSPF Route Area Border

Displays the OSPF Area Border Router (ABR) information.

Syntax:

show ospf route area-border

Example: OSPF Route ABR information

supervisor@rtbrick>SPINE01: cfg> show ospf route area-border
Instance: default, Area: 198.51.100.0
  Node ID         Cost     Advertising Router    Flags       Interface      Nexthop
  198.51.100.20   10000    198.51.100.20        -|-|-|B      ifl-0/0/0/1    198.51.100.27
  198.51.100.30    20000   198.51.100.30        -|-|-|B      ifl-0/0/0/1    198.51.100.27
  198.51.100.40    55000   198.51.100.40        -|-|-|B      ifl-0/0/0/1    198.51.100.27
  198.51.100.50    55000   198.51.100.50        -|-|-|B      ifl-0/0/0/1    198.51.100.27

OSPF Route Autonomous System Boundary

Displays Autonomous System Boundary Router information.

Syntax:

show ospf route autonomous-system-boundary

Example: OSPF Route ASBR information

supervisor@rtbrick>SPINE01: cfg> show ospf route autonomous-system-boundary
Instance: default, Area:
  Node ID         Cost     Advertising Router  Flags     Interface         Nexthop
  198.51.100.32    40000    198.51.100.20                ifl-0/0/0/1      198.51.100.27

OSPF LSA Request List

Displays the list of all link-state advertisements (LSAs) requests that have been sent or received by a router.

Syntax:

show ospf request-list <options>

Option Description

-

Without any option,, this command displays the list of all link-state advertisement (LSA) requests that have been sent from the router.

detail

Provides detailed information on the requests that have been sent from the router.

Example 1: OSPF LSA requests sent to a neighbor

supervisor@rtbrick>SPINE01: op> show ospf request-list
Instance: default
  Type            Link State ID   Advertising Router          Age        Sequence   Checksum
  Summary-Network 11.0.0.0        198.51.100.20                 42      0x80000003     0x76e5
  Summary-Network 12.0.0.0        198.51.100.20                 42      0x80000003     0x603d
  Summary-Network 12.1.0.0        198.51.100.20                 42      0x80000003     0x481f
  Summary-Network 12.2.0.0        198.51.100.20                 42      0x80000003     0x4aab
  Summary-Network 12.3.0.0        198.51.100.20                 42      0x80000003     0xc5e4
  Summary-Network 23.0.0.0        198.51.100.20                 42      0x80000003     0xd5bb
  Summary-Network 23.1.0.0        198.51.100.20                 42      0x80000003     0xca2a

Example 2: Detailed information for OSPF LSA requests sent to a neighbor

supervisor@rtbrick>SPINE01: op>  show ospf request-list detail
Instance: default LSAs
  LSA ID: 11.0.0.0
    Advertising router: 198.51.100.20, LSA type: Summary-Network, Router ID: 192.168.0.20
    Sequence number: 0x80000003, Checksum: 0x76e5, LSA age: 42
    Interface: hostif-0/0/0/1, Neighbor address: 25.0.1.2
    Length: 0, Options: *|-|-|-|-|-|-|*
  LSA ID: 12.0.0.0
    Advertised router: 198.51.100.20, LSA type: Summary-Network, Router ID: 192.168.0.20
    Sequence number: 0x80000003, Checksum: 0x603d, LSA age: 42
    Interface: hostif-0/0/0/1, Neighbor address: 25.0.1.2
    Length: 0, Options: *|-|-|-|-|-|-|*
  LSA ID: 12.1.0.0
    Advertised router: 198.51.100.20, LSA type: Summary-Network, Router ID: 192.168.0.20
    Sequence number: 0x80000003, Checksum: 0x481f, LSA age: 42
    Interface: hostif-0/0/0/1, Neighbor address: 25.0.1.2
    Length: 0, Options: *|-|-|-|-|-|-|*
  LSA ID: 12.2.0.0
    Advertised router: 198.51.100.20, LSA type: Summary-Network, Router ID: 192.168.0.20
    Sequence number: 0x80000003, Checksum: 0x4aab, LSA age: 42
    Interface: hostif-0/0/0/1, Neighbor address: 25.0.1.2
    Length: 0, Options: *|-|-|-|-|-|-|*

 <...>

OSPF Transmission List

Displays the list of all LSAs waiting to be re-sent or transmitted from the router.

Syntax:

show ospf transmit-list <option>

Option Description

detail

Provides detailed information on all LSAs waiting to be re-sent.

Example: OSPF LSA requests waiting to be transmitted.

supervisor@rtbrick>SPINE01: op> show ospf transmit-list
Instance: default, Area: 0.0.0.1, Interface: ifl-0/0/4/1, Neighbor: 25.0.1.5
  LSA ID                    LS type                   Advertising router        Transmit interval         Retransmit count
  11.0.0.0                  Summary-Network           198.51.100.20              5000                      1
  12.0.0.0                  Summary-Network           198.51.100.20              5000                      1
  23.0.0.0                  Summary-Network           198.51.100.20              5000                      1
  12.1.0.0                  Summary-Network           198.51.100.20              5000                      1
  23.1.0.0                  Summary-Network           198.51.100.20              5000                      1
  12.2.0.0                  Summary-Network           198.51.100.20              5000                      1
  12.3.0.0                  Summary-Network           198.51.100.20              5000                      1

OSPF Statistics

Displays OSPF statistics information.

Syntax:

show ospf statistics <options>

Option Description

interface <interface-name>

Displays packet statistics information for the specified interface.

interface <interface-name> detail

Displays detailed packet statistics information for the specified interface.

neighbor <neighbor-address>

Displays packet statistics information for the specified neighbor.

neighbor <neighbor-address> detail

Displays detailed packet statistics information for the specified neighbor.

supervisor@rtbrick>SPINE01: op> show ospf statistics interface ifl-0/0/0/1 detail
Instance: default
  Interface: interface ifl-0/0/0/1, Peer address: 56.0.1.5
    Hello packet:
      Recieved packets: 107, Sent packets: 109, Total errors: 1, Unsupported option: 0
      Area mismatch: 0, Area type option mistmatch: 0, Dead interval mismatch: 0
      Hello interval mismatch: 0, Mask mismatch: 0, Self router ID: 0
      Obj add fail: 0, Source address mismatch: 0, Misc: 0
    DD packet:
      Recieved packets: 11, Sent packets: 10, Total errors: 1, Unsupported option: 0
      Invalid state packet rcvd: 0, MTU mismatch: 0, DD obj add fail: 0, Misc: 0, Negotiation fail: 0
      Master bit mismatch: 0, Exchange state init pkt: 0, Capabilities mismatch: 0
      Expected seq mismatch: 0, Full state init pkt: 1
    LS request packet:
      Recieved packets: 0, Sent packets: 0, Total errors: 0, Invalid LSA type: 0
      Invalid state packet rcvd: 0, LSA lookup error: 0, LSA lookup fail: 0
      LSA obj add fail: 0, Misc: 0
    LS update packet:
      Recieved packets: 50, Sent packets: 0, Total errors: 4, Invalid LSA type: 0
      Zero length LSA: 0, LSA length exceeded: 0, LSA checksum fail: 0
      Invalid state packet rcvd: 4, LSA obj add fail: 0, Misc: 0
    Ls ack packet:
      Recieved packets: 11, Sent packets: 0, Total errors: 0, LSA obj add fail: 0
      Invalid state packet rcvd: 0, Misc: 0
    Sanity errors:
      Payload max len error: 0, Payload min len error: 0, Invalid version: 0
      Invalid auth data len: 0, Auth data missing: 0, Invalid packet min len: 0
      Invalid area ID: 0, Invalid network mask: 0, Authentication fail: 2

OSPF Clear Commands

Clear OSPF Neighbor

Clear OSPF neighbor state information.

Syntax:

clear ospf neighbor <options>

Option Description

-

Without any option, the command clears all the OSPF neighbors.

instance <instance-name>

Clears OSPF neighbor information for the specified instance.

instance <instance-name> area <area-id>

Clears OSPF neighbor for the specified area of the specified instance.

instance <instance-name> area <area-id> interface <interface-name>

Clears OSPF neighbor for the specified interface for the specified area of the specified instance.

force

Forcefully clears all the OSPF neighbors. This may impact DR/BDR election.

force instance <instance-name>

Forcefully clears the neighbor for the specified instance.

force instance <instance-name> area <area-id>

Forcefully clears OSPF neighbor for the specified area of the specified instance.

force instance <instance-name> area <area-id> interface <interface-name>

Forcefully clears OSPF neighbor for a specific interface and area of the specified instance.

Example:

supervisor@rtbrick>SPINE01: cfg> clear ospf neighbor instance default area 198.51.100.0 interface ifl-0/0/1/100
Instance [default], area[0.0.0.1], interface[ifl-0/0/1/100] clear triggered

Clear OSPF Statistics

Clear the OSPF statistics for all instances or for a specified instance.

Syntax:

clear ospf statistics <options>

Option Description

-

Without any option, the command clears all the OSPF statistics.

instance <instance-name>

Clears OSPF statistics information for the specified instance.

instance <instance-name> area <area-id>

Clears OSPF statistics for the specified area of the specified instance.

instance <instance-name> area <area-id> interface <interface-name>

Clears OSPF statistics for the specified interface for the specified area of the specified instance.

Example:

supervisor@rtbrick>SPINE01: cfg> clear ospf statistics instance default area 0.0.0.0 interface ifl-0/0/1/1
Cleared statistics for all neighbors under Instance [default] Area [0.0.0.0] Interface [ifl-0/0/1/1]