OSPF Configuration Module

This configuration module configures OSPFv2 and OSPFv3 routing processes on most supported platforms (see supported features and platform support).

Note

Use netlab report or netlab create -o report commands to create reports on OSPF areas, routers, and interfaces. Use the ‌netlab show reports ospf command to display available OSPF reports.

Supported Features

Supported OSPF features:

Missing features:

  • Virtual links

  • Opaque LSA

  • Multi-area adjacencies

  • Demand circuits

  • A gazillion nerd knobs and IETF quirks

Need one of those? Create a plugin and contribute it.

Platform Support

We implemented OSPFv2, OSPFv3, OSPF areas, reference bandwidth, passive interfaces, and point-to-point circuits on almost all devices. The missing bits are documented as caveats in the Core OSPF features column in the following table, which includes the per-platform support of other router-level OSPF features:

Device

Core OSPF

features

Unnumbered

IPv4 interfaces

Route

import

Default

route

BFD

Arista EOS

Arrcus ArcOS

Aruba AOS-CX

BIRD

Cisco ASAv

Cisco IOS[*1]

Cisco IOS XR[*2]

Cisco Nexus OS

Cumulus 5.x (NVUE)

Cumulus Linux

Dell OS10

Extreme EXOS

Fortinet FortiOS firewall

FRRouting

Junos[*3]

Mikrotik RouterOS 6

Mikrotik RouterOS 7

Nokia SR Linux

Nokia SR OS[*4]

OpenBSD

SONiC

VPP fd.io container

VyOS

Notes:

  • Use the netlab show modules -m ospf command to display the route types that can be imported into OSPFv2/OSPFv3.

The following devices support OSPF graceful restart:

Device

OSPFv2

OSPFv3

BIRD

Fortinet FortiOS firewall

FRRouting

SONiC

Tip

See OSPFv2 and OSPFv3 Integration Tests Results for more details.

These devices also support optional OSPF interface attributes:

Device

Interface

timers

Router

priority

Cleartext

password

Arista EOS

Arrcus ArcOS

Aruba AOS-CX

BIRD

Cisco ASAv

Cisco IOS[*1]

Cisco IOS XR[*2]

Cisco Nexus OS

Cumulus 5.x (NVUE)

Cumulus Linux

Dell OS10

Extreme EXOS

Fortinet FortiOS firewall

FRRouting

Junos[*3]

OpenBSD

SONiC

VPP fd.io container

VRF OSPF instances are implemented on these devices:

Device

OSPFv2 VRF

instances

OSPFv3 VRF

instances

Arista EOS

Arrcus ArcOS

Aruba AOS-CX

BIRD

Cisco IOS[*1]

Cisco IOS XR[*2]

Cisco Nexus OS

Cumulus 5.x (NVUE)

Cumulus Linux

Dell OS10

FRRouting

Junos[*3]

Mikrotik RouterOS 6

Mikrotik RouterOS 7

Nokia SR Linux

Nokia SR OS[*4]

VyOS

Node Parameters

  • ospf.process – process ID (default: 1)

  • ospf.afOSPF address families, usually set by the data transformation code. Configures OSPFv2 when ospf.af.ipv4 is set to True and OSPFv3 (on devices that support OSPFv3) when ospf.af.ipv6 is set to True.

  • ospf.area – default OSPF area (default: 0.0.0.0). Used on links/interfaces (including the loopback interface) without an explicit OSPF area.

  • ospf.bfd – enable BFD for OSPF (default: False)

  • ospf.bfd.strict enables RFC9355 BFD Strict-Mode (default: False)

  • ospf.gr – OSPF graceful restart settings. ospf.gr.restart can be true (enable GR with default settings) or a dictionary with grace_period (1–1800 seconds). ospf.gr.helper can be true (enable GR helper with default settings) or a dictionary with grace_period (10–1800 seconds). You can also set ospf.gr to a boolean value as a shortcut for ospf.gr.restart.

  • ospf.default – External default route origination (more details)

  • ospf.digest – default OSPFv2 digest authentication parameters. Applies to all interfaces without an explicit ospf.digest setting.

  • ospf.importimport (redistribute) routes into the global OSPF instance. By default, no routes are redistributed into the global OSPF instance.

  • ospf.password – default OSPFv2 cleartext authentication password. Applies to all interfaces without an explicit ospf.password setting.

  • ospf.priority – node-wide OSPF router priority. Applies to all interfaces without an explicit ospf.priority setting.

  • ospf.reference_bandwidth – per-node OSPF auto-cost reference bandwidth (in Mbps).

  • ospf.router_id – set static router ID.

  • ospf.passive – node-level default for passive interfaces (default: False)

  • ospf.timers – default OSPF interface timers. You can override the node values on individual interfaces.

You can specify most node parameters as global values (top-level topology elements) or within individual nodes (see example for details).

VRF Parameters

  • You can use most OSPF node parameters (for example, area, digest, gr, password, or timers) in VRF definitions to change the VRF OSPF instance configuration.

  • By default, netlab redistributes BGP- and connected routes into VRF OSPF instances on all network devices. You can change that on devices supporting configurable route import with the ospf.import VRF parameter.

  • You can change the router ID of a VRF OSPF instance with ospf.router_id parameter. Use this parameter when building back-to-back links between VRFs on the same node.

  • Set ospf.active to True to force a VRF to use OSPF even when no routers are attached to the VRF interfaces.

  • To disable OSPF in a VRF set ospf to False (see also Disabling a Routing Protocol in VRF).

  • To originate a default route in a VRF OSPF instance, set the ospf.default VRF parameter (more details)

Interface Parameters

Most OSPF interface parameters can be specified on the link and are copied into interface data and configured on lab devices; these parameters can only be set on individual interfaces:

  • ospf.priority – OSPF router priority

Specifying External Default Route

The ospf.default parameter specifies that the device should originate an external (E1 or E2) default route into an OSPF domain. It can be set to true or false; you can also be more specific and use the following settings:

  • ospf.default.always: set to True when you want the device to originate an OSPF default route, even when it does not have a default route itself.

  • ospf.default.cost: set the cost of the originated default route

  • ospf.default.type: the OSPF type of the external default route (e1 or e2).

Example

We want to create a three-router multi-area OSPF network:

  • R1 is a backbone area router

  • R2 is ABR between the backbone area and area 1

  • R3 is in an intra-area router in area 1.

All devices run OSPF:

module: [ ospf ]

The default OSPF area is 0.0.0.0:

ospf:
  area: 0.0.0.0

R1 and R2 are in the default OSPF area (no need to specify per-node area):

nodes:
  r1:
    device: iosv
  r2:
    device: eos

R3 is in area 1. Non-default OSPF area must be specified within node data:

nodes:
  r3:
    device: nxos
    ospf:
      area: 0.0.0.1

The link between R1 and R2 is in area 0. No need to specify per-link area:

links:
- r1:
  r2:

The link between R2 and R3 is in area 1. Specify the OSPF area within the link definition:

links:
- r2:
  r3:
  ospf:
    area: 0.0.0.1

Alternatively, you could specify the OSPF area just for R2 (as R3 is already in area 1):

links:
- r2:
    ospf:
      area: 0.0.0.1
  r3:

Interesting details:

  • The default value for the interface OSPF area is the node OSPF area

  • The default value for node OSPF area is the global OSPF area (default value: 0.0.0.0).

  • Due to the propagation of default values, the OSPF area for the R2-R3 link would be area 0 on R2 and area 1 on R3 – you have to specify the OSPF area within the link definition or an individual node connected to the link.

Resulting Device Configurations

The above topology generates the following device configurations:

R1 (Cisco IOS)

router ospf 1
!
interface Loopback0
 ip ospf 1 area 0.0.0.0
!
interface GigabitEthernet0/1
 ip ospf 1 area 0.0.0.0
 ip ospf network point-to-point

R2 (Arista EOS)

router ospf 1
!
interface Loopback0
 ip ospf area 0.0.0.0
!
interface Ethernet1
 ip ospf area 0.0.0.0
 ip ospf network point-to-point
!
interface Ethernet2
 ip ospf area 0.0.0.1
 ip ospf network point-to-point

R3 (Cisco Nexus-OS)

feature ospf
!
router ospf 1
!
interface loopback0
 ip router ospf 1 area 0.0.0.1
!
interface Ethernet1/1
 ip router ospf 1 area 0.0.0.1
 ip ospf network point-to-point

Complete network topology:

module: [ ospf ]

ospf:
  area: 0.0.0.0

nodes:
  r1:
    device: iosv
  r2:
    device: eos
  r3:
    device: nxos
    ospf:
      area: 0.0.0.1

links:
- r1:
  r2:

- r2:
  r3:
  ospf:
    area: 0.0.0.1