Download PDF
Home

1. Introduction to OSPF

Open Shortest Path First (OSPF) is an interior gateway protocol (IGP) that routes packets within a single autonomous system (AS). OSPF uses link-state information to make routing decisions, making route calculations using the shortest-path-first (SPF) algorithm. Like all link-state protocols, OSPF is very efficient in its use of network bandwidth.

1.1. Supported OSPF Standards

RtBrick FullStack (RBFS) substantially supports the following RFCs, which define standards for OSPF and OSPF version 2 (OSPFv2).

  • RFC 2328, OSPF Version 2

  • RFC 8665, OSPF Extensions for Segment Routing

1.2. Supported OSPF Features

The RBFS implementation conforms to the OSPF Version 2 specifications detailed in the RFC 2328. The following list outlines the key features supported in the RBFS OSPF implementation:

  • Stub areas—The definition of stub areas is supported.

  • Route redistribution—Routes learned via any IP routing protocol can be redistributed into any other IP routing protocol.

  • Authentication—Plain text (simple) and message-digest algorithm 5 (MD5) authentication among neighboring routers within an area is supported.

  • Routing interface parameters—Configurable parameters supported include opaque-capability, router priority, segment-routing, sid-index, router “dead” and hello intervals, and authentication key.

2. Configuring OSPF

2.1. Configuration Hierarchy

The diagram illustrates the OSPF configuration hierarchy. All OSPF configuration is performed within an instance, for example the default instance or a VPN service instance. The OSPF instance configuration hierarchy includes parameters which are generic to the respective OSPF instance. The sub-hierarchies include parameters which are specific to redistribution or authentication.

OSPF Configuration Hierarchy

2.2. Configuration Syntax and Commands

The following sections describe the OSPF configuration syntax and commands.

2.2.1. OSPF Instance Configuration

At this configuration hierarchy you configure OSPF protocol parameters which are generic to the OSPF instance.

Syntax

set instance <instance-name> protocol ospf <attribute> <value>

Attribute Description

area <area-id>

Identifier of an OSPF area. The area-id argument can be specified in IP address format.

area-type <stub | totally_stub>

Defines an area type such as stub or totally_stub

default-metric <metric>

OSPF interface metric

max-load-balance <max-load-balance>

The maximum number of equal-cost routes for load balancing.

opaque-capability <true / false>

Enable or disable opaque LSA advertisement and reception.

redistribute <source>

Enable the redistribution feature to dynamically inject specific types of routes into the OSPF protocol. Supported route sources are bgp, direct, static, and isis.

router-id <ipv4-address>

The router ID of the routing instance. The router-id configuration is mandatory since RBFS does not pick router-id from device interfaces.

segment-routing <true / false>

Enable or disable segment routing forwarding in OSPF.

srgb base <value>

Segment Routing Global Block (SRGB) start label. The SRGB is the range of label values reserved for segment routing (SR). These values are assigned as segment identifiers (SIDs) to SR-enabled network nodes and have global significance throughout the routing

srgb range <value>

Segment Routing Global Block (SRGB) label range

Example: OSPF Instance Configuration

The following example shows some global OSPF instance configuration attributes.

supervisor@rtbrick: cfg> show config instance default
{
  "rtbrick-config:instance": {
    "name": "default",
    "protocol": {
      "ospf": {
        "router-id": "2.2.2.2",
        "opaque-capability": "true",
        "segment-routing": "true",
        "srgb": {
          "base": 1000,
          "range": 1000
        },
        "area": [
          {
            "area-id": "0.0.0.0",
            "interface": [
              {
                "interface-name": "ifl-0/1/2/1"
              },
              {
                "interface-name": "ifl-0/2/3/1"
              },
              {
                "interface-name": "ifl-1/1/2/1"
              }
            ]
          }
        ]
      }
    }
2.2.1.1. OSPF Redistribution

Enable the redistribution feature to dynamically inject specific types of routes into the OSPF protocol. Supported route sources are bgp, direct, static, and isis.

Syntax

set instance <instance-name> ospf redistribute <attribute> <value>

Attribute Description

bgp <true / false>

Distributes routes from the BGP protocol.

Direct <true / false>

Distributes routes from the directed-attached gateway redundancy (DAGR)

isis <true / false>

Distributes routes from the IS-IS protocol.

static <true / false>

Distributes IP static routes.

Example: Redistribution Configuration

TBD

2.2.2. OSPF Area Configuration

Area number used to define the particular area.

set instance <instance-name> protocol ospf area <area-id> interface <interface-name>

Attribute Description

<instance-name>

Name of the OSPF instance

<area-id>

Area number used to define the particular area

<interface-name>

Name of the interface

Example: Interface Area Configuration

supervisor@fwdd-r2: cfg> show config instance default protocol ospf area 0.0.0.0
{
  "rtbrick-config:area": {
    "area-id": "0.0.0.0",
    "interface": [
      {
        "interface-name": "memif-0/1/2/1"
      },
      {
        "interface-name": "memif-0/2/3/1"
      },
      {
        "interface-name": "memif-1/1/2/1"
      }
    ]
  }
}
supervisor@fwdd-r2: cfg>

2.2.3. OSPF Interface Configuration

Syntax:

set instance <instance-name> protocol ospf area <area-id> interface <interface-name> <attribute> <value>

Attribute Description

<instance-name>

Name of the OSPF instance

<interface-name>

Name of the interface

<metric-value>

Specify the cost of an OSPF interface

network-type <broadcast | p2p>

broadcast - Sets the network type to broadcast; p2p - Sets the network type to point-to-point.

dr-priority <dr-priority>

Sets the router priority for an interface.

sid-index <sid-index>

Specifies the prefix segment identifier (SID) index on the OSPF-enabled interface

dead <dead>

Specifies the length of time, in seconds, that the routing device waits before declaring that a neighboring routing device is unavailable. The range is 1 through 65,535 seconds.

hello <hello>

Specifies the length of time, in seconds, before the routing device sends a hello packet out of an interface. The range is from 1 through 255 seconds.

Example: Interface Area Configuration

supervisor@fwdd-r2: cfg> show config instance default protocol ospf area 0.0.0.0 interface ifl-0/1/2/1
{
  "rtbrick-config:interface": {
    "interface-name": "ifl-0/1/2/1"
  }
}
supervisor@fwdd-r2: cfg>

2.2.4. OSPF Authentication

OSPF supports the following two types of authentication:

  • MD5 authentication

  • Simple authentication

The authentication is accomplished by the exchange of an authenticating key that is known by both the sending and receiving router.

2.2.4.1. OSPF MD5 authentication

This command enables you to set Message Digest 5 (MD5) authentication for an OSPF interface.

set instance <instance-name> protocol ospf area <area-id> interface <interface-name> authentication md5 key_id <key_id> password <password>

Attribute Description

<instance-name>

Name of the OSPF instance

<area-id>

Area number used to define the particular area

<interface-name>

Name of the interface

<key_id>

Specifies a key ID.

<password>

Specifies the password to be used by neighboring routers that are using the OSPF md5 password authentication

Example: Interface Authentication MD5 Configuration

supervisor@fwdd-r1: cfg> show config instance red protocol ospf area 0.0.0.0 interface ifl-0/0/1/1 authentication type md5
{
  "data": {
    "rtbrick-config:instance": [
      {
        "name": "red",
        "protocol": {
          "ospf": {
            "redistribute": {
              "direct": "true"
            },
            "area": [
              {
                "area-id": "0.0.0.0",
                "interface": [
                  {
                    "interface-name": "ifl-0/0/1/1",
                    "authentication": {
                      "type": "md5",
                      "key-id": 1,
                      "encrypted-text": "$2bae0eaf367ec906a2fa325496c6485fb"
                    }
                  }
                ]
              }
            ]
          }
        }
      }
    ]
  }
}
supervisor@fwdd-r1: cfg>
2.2.4.2. OSPF Simple Authentication

This command enables you to set simple authentication for an OSPF interface.

set instance <instance-name> protocol ospf area <area-id> interface <interface-name> authentication simple password <password>

Attribute Description

<instance-name>

Name of the OSPF instance

<area-id>

Area number used to define the particular area

<interface-name>

Name of the interface

<password>

Specifies the password to be used by neighboring routers that are using the OSPF simple password authentication

Example: Interface Authentication Simple Configuration

supervisor@fwdd-r1: cfg> show config instance red protocol ospf area 0.0.0.0 interface lo-0/0/1/1 authentication plain-text abcd123
{
  "data": {
    "rtbrick-config:instance": [
      {
        "name": "red",
        "protocol": {
          "ospf": {
            "area": [
              {
                "area-id": "0.0.0.0",
                "interface": [
                  {
                    "interface-name": "ifl-0/0/1/1",
                    "authentication": {
                      "key-id": 1,
                      "encrypted-text": "$2bae0eaf367ec906a2fa325496c6485fb"
                    }
                  }
                ]
              }
            ]
          }
        }
      }
    ]
  }
}
supervisor@fwdd-r1: cfg>

3. OSPF Operational Commands

3.1. OSPF Show Commands

3.1.1. OSPF Summary

Displays the OSPF summary information.

Syntax:

show ospf summary <option>

Option Description

-

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

instance <instance-name>

OSPF summary information for the given instance.

Example: OSPF summary for the default instance

supervisor@fwdd-r2: op> show ospf summary
Instance: default
  General information
    Router ID: 2.2.2.2, Flags: -|-|-|-|-
    Flood interval: 3000, Area count: 1,
    Opaque capability: True
    Segment routing capability: True
    SRGB base: 1000
    SRGB range: 1000
    SRGB label values: 1000 - 1999
  Area: 0.0.0.0
    Interface count: 3
    Interface: memif-0/1/2/1
      Address: 10.1.1.2, Cost: 1, State: DR
      Type: broadcast, MTU: 1500, Priority: 1
      Designated Router: 10.1.1.2, Backup Designated Router: 10.1.1.1
      Timers
        Hello interval: 10 sec, Dead interval: 40 sec
    Interface: memif-0/2/3/1
      Address: 30.1.1.2, Cost: 1, State: Backup
      Type: broadcast, MTU: 1500, Priority: 1
      Designated Router: 30.1.1.3, Backup Designated Router: 30.1.1.2
      Timers
        Hello interval: 10 sec, Dead interval: 40 sec
    Interface: memif-1/1/2/1
      Address: 20.1.1.2, Cost: 1, State: DR
      Type: broadcast, MTU: 1500, Priority: 1
      Designated Router: 20.1.1.2, Backup Designated Router: 20.1.1.1
      Timers
        Hello interval: 10 sec, Dead interval: 40 sec
 <....>

3.1.2. OSPF Interface

Displays OSPF information specific to interfaces.

Syntax:

show ospf interface <option>

Option Description

-

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

instance <instance-name>

OSPF interface information for the given instance.

Example: OSPF interface information for the default instance

supervisor@fwdd-r2: op> show ospf interface
Instance: default
  Interface            Area            IP Address      State          Type       Cost     Priority DR              BDR             MTU
  memif-0/1/2/1        0.0.0.0         10.1.1.2        DR             broadcast  1        1        10.1.1.2        10.1.1.1        1500
  memif-0/2/3/1        0.0.0.0         30.1.1.2        Backup         broadcast  1        1        30.1.1.3        30.1.1.2        1500
  memif-1/1/2/1        0.0.0.0         20.1.1.2        DR             broadcast  1        1        20.1.1.2        20.1.1.1        1500
Instance: vrf1
  Interface            Area            IP Address      State          Type       Cost     Priority DR              BDR             MTU
  memif-2/1/2/1        0.0.0.0         40.1.1.2        DR             broadcast  1        1        40.1.1.2        40.1.1.1        1500
supervisor@fwdd-r2: op> show ospf interface instance

3.1.3. OSPF Neighbor

Displays adjacency information.

Syntax:

show ospf neighbor <option>

Option Description

-

Without any option, the commands displays the adjacency information for all instances.

instance <instance-name>

OSPF adjacency information for the given instance.

Example: OSPF adjacency information for the default instance

supervisor@fwdd-r2: op> show ospf neighbor
Instance: default
  Address         Interface            Router ID  Area            State      Priority DR              BDR             Uptime          Expires
  10.1.1.1        memif-0/1/2/1        1.1.1.1    0.0.0.0         Full       1        10.1.1.2        10.1.1.1        0d:05h:33m:40s  39 Seconds
  30.1.1.3        memif-0/2/3/1        5.5.5.5    0.0.0.0         Full       1        30.1.1.3        30.1.1.2        0d:05h:33m:40s  36 Seconds
  20.1.1.1        memif-1/1/2/1        1.1.1.1    0.0.0.0         Full       1        20.1.1.2        20.1.1.1        0d:05h:33m:40s  39 Seconds
Instance: vrf1
  Address         Interface            Router ID  Area            State      Priority DR              BDR             Uptime          Expires
  40.1.1.1        memif-2/1/2/1        3.3.3.3    0.0.0.0         Full       1        40.1.1.2        40.1.1.1        0d:05h:33m:37s  40 Seconds
supervisor@fwdd-r2: op>

3.1.4. OSPF Database

Displays the entries in the OSPF link-state database, which contains data about link-state advertisement (LSA) packets.

Syntax:

show ospf database <option>

Option Description

-

Without any option, the commands displays the database information for all instances.

instance <instance-name>

OSPF database information for the given instance.

Example: OSPF database information for the default instance

supervisor@fwdd-r2: op> show ospf database
Instance: default, Area: 0.0.0.0
  Type            Link State ID   Adv Router      Age      Sequence Number Checksum Cost
  Router          1.1.1.1         1.1.1.1         1914     0x8000002e      7502
  Router          2.2.2.2         2.2.2.2         1442     0x800000cf      64388
  Router          5.5.5.5         5.5.5.5         883      0x800000b0      48439
  Network         10.1.1.2        2.2.2.2         2579     0x8000001e      8378
  Network         20.1.1.2        2.2.2.2         2579     0x80000020      39221
  Network         30.1.1.3        5.5.5.5         869      0x8000006c      53896
  Summary-Network 1.1.1.2         1.1.1.1         2766     0x8000001c      9682     1
  Opaque Area     4.0.0.0         2.2.2.2         399      0x80003069      56010
  Opaque Area     4.0.0.0         5.5.5.5         107      0x800001ca      21522
  Opaque Area     7.0.0.0         1.1.1.1         2034     0x8000001d      13222
Instance: vrf1, Area: 0.0.0.0
  Type            Link State ID   Adv Router      Age      Sequence Number Checksum Cost
  Router          3.3.3.3         3.3.3.3         1905     0x80000009      63459
  Router          4.4.4.4         4.4.4.4         6        0x80000022      34610
  Network         40.1.1.2        4.4.4.4         1554     0x8000001d      51739
Instance: default
  Type            Link State ID   Adv Router      Age      Sequence Number Checksum Cost
  External        4.1.2.4         2.2.2.2         1379     0x80000003      56353    0
supervisor@fwdd-r2: op>
3.1.4.1. OSPF Database for a Specific Area

Displays the LSAs in a particular area.

Syntax:

show ospf database area <area-id>

Option Description

<area-id>

Area ID of the route.

Example: OSPF area identifier information for the default instance

supervisor@fwdd-r2: op> show ospf database area 0.0.0.0
Instance: default, Area: 0.0.0.0
  Type            Link State ID   Adv Router      Age      Sequence Number Checksum Cost
  Router          1.1.1.1         1.1.1.1         1948     0x8000002e      7502
  Router          2.2.2.2         2.2.2.2         1476     0x800000cf      64388
  Router          5.5.5.5         5.5.5.5         917      0x800000b0      48439
  Network         10.1.1.2        2.2.2.2         2613     0x8000001e      8378
  Network         20.1.1.2        2.2.2.2         2613     0x80000020      39221
  Network         30.1.1.3        5.5.5.5         903      0x8000006c      53896
  Summary-Network 1.1.1.2         1.1.1.1         16       0x8000001d      9171     1
  Opaque Area     4.0.0.0         2.2.2.2         433      0x80003069      56010
  Opaque Area     4.0.0.0         5.5.5.5         112      0x800001cb      30952
  Opaque Area     7.0.0.0         1.1.1.1         2068     0x8000001d      13222
Instance: vrf1, Area: 0.0.0.0
  Type            Link State ID   Adv Router      Age      Sequence Number Checksum Cost
  Router          3.3.3.3         3.3.3.3         1939     0x80000009      63459
  Router          4.4.4.4         4.4.4.4         40       0x80000022      34610
  Network         40.1.1.2        4.4.4.4         1588     0x8000001d      51739
supervisor@fwdd-r2: op>
3.1.4.2. OSPF Database for External Routes

Displays external LSAs.

Syntax:

show ospf database external

Example: OSPF external route information for the default instance

supervisor@fwdd-r2: op> show ospf database external
Instance: default
  Type            Link State ID   Adv Router      Age      Sequence Number Checksum Cost
  External        4.1.2.4         2.2.2.2         1441     0x80000003      56353    0
supervisor@fwdd-r2: op>

3.1.5. OSPF Route

Displays the entries in the OSPF routing table.

Syntax:

show ospf route <option>

Option Description

-

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

instance <instance-name>

OSPF route information for the given instance.

Example: OSPF route information for the default instance

supervisor@fwdd-r2: op> show ospf route
Instance: default, SAFI: unicast
  Prefix                     Area             Type             Cost      Next Hop        Interface
  1.1.1.2/32                 0.0.0.0          inter-area       2         20.1.1.1        memif-1/1/2/1
                                                                         10.1.1.1        memif-0/1/2/1
  1.1.1.3/32                 0.0.0.0          intra-area       2         20.1.1.1        memif-1/1/2/1
                                                                         10.1.1.1        memif-0/1/2/1
  10.1.1.0/24                0.0.0.0          Ospf_Direct      1         0.0.0.0         memif-0/1/2/1
  20.1.1.0/24                0.0.0.0          Ospf_Direct      1         0.0.0.0         memif-1/1/2/1
  30.1.1.0/24                0.0.0.0          Ospf_Direct      1         0.0.0.0         memif-0/2/3/1
Instance: vrf1, SAFI: unicast
  Prefix                     Area             Type             Cost      Next Hop        Interface
  40.1.1.0/24                0.0.0.0          Ospf_Direct      1         0.0.0.0         memif-2/1/2/1
supervisor@fwdd-r2: op>
3.1.5.1. OSPF Labeled Unicast Routes
TBD
3.1.5.2. OSPF MPLS Routes
TBD
3.1.5.3. OSPF Unicast Route

Syntax:

show ospf route unicast

supervisor@fwdd-r2: op> show ospf route unicast
Instance: default, SAFI: unicast
  Prefix                     Area             Type             Cost      Next Hop        Interface
  1.1.1.2/32                 0.0.0.0          inter-area       2         20.1.1.1        memif-1/1/2/1
                                                                         10.1.1.1        memif-0/1/2/1
  1.1.1.3/32                 0.0.0.0          intra-area       2         20.1.1.1        memif-1/1/2/1
                                                                         10.1.1.1        memif-0/1/2/1
  10.1.1.0/24                0.0.0.0          Ospf_Direct      1         0.0.0.0         memif-0/1/2/1
  20.1.1.0/24                0.0.0.0          Ospf_Direct      1         0.0.0.0         memif-1/1/2/1
  30.1.1.0/24                0.0.0.0          Ospf_Direct      1         0.0.0.0         memif-0/2/3/1
Instance: vrf1, SAFI: unicast
  Prefix                     Area             Type             Cost      Next Hop        Interface
  40.1.1.0/24                0.0.0.0          Ospf_Direct      1         0.0.0.0         memif-2/1/2/1
supervisor@fwdd-r2: op>

3.1.6. OSPF SPF Result

Syntax:

show ospf spf result <option>

Option Description

-

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

area <area-id>

Displays information about the specified area.

instance <instance-name>

OSPF summary information for the given instance.

Example: OSPF SPF Result for the default instance

supervisor@fwdd-r2: op> show ospf spf result
Instance: default, Area: 0.0.0.0
  Node ID         Type            Cost     Node Adv Router Flags        Neighbor Node         Interface         Nexthop
  1.1.1.1         ROUTER          1        1.1.1.1         1            1.1.1.1               memif-0/1/2/1     10.1.1.1
                                                                        1.1.1.1               memif-1/1/2/1     20.1.1.1
  5.5.5.5         ROUTER          1        5.5.5.5         0            5.5.5.5               memif-0/2/3/1     30.1.1.3
Instance: vrf1, Area: 0.0.0.0
  Node ID         Type            Cost     Node Adv Router Flags        Neighbor Node         Interface         Nexthop
  3.3.3.3         ROUTER          1        3.3.3.3         0            3.3.3.3               memif-2/1/2/1     40.1.1.1
supervisor@fwdd-r2: op>

3.1.7. OSPF Statistics

3.1.7.1. OSPF Route Statistics

Displays OSPF statistics for all routing instances.

Syntax:

show ospf route statistics

Example: OSPF route statistics for all routing instances.

supervisor@fwdd-r2: op> show ospf route statistics
Instance: default
  Start Time               Elapsed Time     Reason           ID               Area             Intra     Inter     External
  2021-03-26 04:30:40      340us            SPF_CHANGE       1.1.1.1          0.0.0.0          1         1         0
  2021-03-26 04:30:40      31us             SPF_CHANGE       5.5.5.5          0.0.0.0          0         0         0
  2021-03-26 04:30:40      83us             SPF_CHANGE       30.1.1.3         0.0.0.0          1         0         0
  2021-03-26 04:30:46      308us            SPF_CHANGE       30.1.1.3         0.0.0.0          1         0         0
  2021-03-26 04:30:46      291us            SPF_CHANGE       1.1.1.1          0.0.0.0          1         1         0
  2021-03-26 04:30:46      22us             SPF_CHANGE       5.5.5.5          0.0.0.0          0         0         0
  <....>

3.1.8. OSPF SPF Statistics

Displays OSPF SPF statistics for all routing instances.

Syntax:

show ospf spf statistics

supervisor@fwdd-r2: op> show ospf spf statistics
Instance: default
  Start Time               Elapsed Time     Area             Reason
  2021-03-26 04:30:02      1056us           0.0.0.0          R-LSA(01)
  2021-03-26 04:30:09      1059us           0.0.0.0          R-LSA(02)
  2021-03-26 04:30:40      1288us           0.0.0.0          R-LSA(06) N-LSA(01)
  2021-03-26 04:30:46      1164us           0.0.0.0          R-LSA(07) N-LSA(03)
  2021-03-26 04:30:48      1298us           0.0.0.0          R-LSA(08) N-LSA(04)
  2021-03-26 04:30:50      1513us           0.0.0.0          R-LSA(08) N-LSA(06)
  <....>

3.2. OSPF Clear Commands

3.2.1. Clear Neighbor Statistics

To clear neighbor statistics and reset adjacencies for OSPF, enter the following command:

Syntax:

clear ospf neighbor instance <instance> area <area-id> interface

Example:

supervisor@rtbrick: cfg> clear ospf neighbor instance default area 0.0.0.0 interface

©Copyright 2021 RtBrick, Inc. All rights reserved. The information contained herein is subject to change without notice. The trademarks, logos and service marks ("Marks") displayed in this documentation are the property of RtBrick in the United States and other countries. Use of the Marks are subject to RtBrick’s Term of Use Policy, available at https://www.rtbrick.com/privacy. Use of marks belonging to other parties is for informational purposes only.