Skip to content

OSPF

OSPF (Open Shortest Path First) is a standards-based link-state interior gateway protocol that uses Dijkstra’s shortest path first algorithm to calculate optimal routes within an autonomous system, supporting VRF-aware multi-instance deployments on NX-OS. It provides hierarchical network design through area-based segmentation with configurable area types (stub, NSSA), route summarization, max-metric advertisement for graceful maintenance, and advanced features like BFD integration for fast failure detection. OSPF interface-level configuration controls process association, area membership, cost, network type, priority, authentication, and passive interface behavior across loopback, VLAN, Ethernet, and port-channel interfaces, and Ethernet and port-channel subinterfaces.

OSPF (Open Shortest Path First) is a standards-based link-state interior gateway protocol that uses Dijkstra’s shortest path first algorithm to calculate optimal routes within an autonomous system, supporting VRF-aware multi-instance deployments on NX-OS. It provides hierarchical network design through area-based segmentation with configurable area types (stub, NSSA), route summarization, max-metric advertisement for graceful maintenance, and advanced features like BFD integration for fast failure detection. OSPF interface-level configuration controls process association, area membership, cost, network type, priority, authentication, and passive interface behavior across loopback, VLAN, Ethernet, and port-channel interfaces.

NameTypeConstraintMandatoryDefault Value
devicesListdevicesNo
device_groupsListdevice_groupsNo
globalClassglobalNo
templatesListtemplatesNo
interface_groupsListinterface_groupsNo

NameTypeConstraintMandatoryDefault Value
devicesListdevicesNo
device_groupsListdevice_groupsNo
globalClassglobalNo
templatesListtemplatesNo

NameTypeConstraintMandatoryDefault Value
configurationClassconfigurationNo

NameTypeConstraintMandatoryDefault Value
configurationClassconfigurationNo

NameTypeConstraintMandatoryDefault Value
configurationClassconfigurationNo

NameTypeConstraintMandatoryDefault Value
configurationClassconfigurationNo

NameTypeConstraintMandatoryDefault Value
configurationClassconfigurationNo

NameTypeConstraintMandatoryDefault Value
routingClassroutingNo
interfacesClassinterfacesNo

NameTypeConstraintMandatoryDefault Value
subinterfacesListsubinterfacesNo
ospfClassospfNo

NameTypeConstraintMandatoryDefault Value
loopbacksListloopbacksNo
vlansListvlansNo
ethernetsListethernetsNo
port_channelsListport_channelsNo

ethernets (nxos.devices.configuration.interfaces)

Section titled “ethernets (nxos.devices.configuration.interfaces)”
NameTypeConstraintMandatoryDefault Value
subinterfacesListsubinterfacesNo
ospfClassospfNo

ethernets (nxos.devices.configuration.interfaces)

Section titled “ethernets (nxos.devices.configuration.interfaces)”
NameTypeConstraintMandatoryDefault Value
ospfClassospfNo

port_channels (nxos.devices.configuration.interfaces)

Section titled “port_channels (nxos.devices.configuration.interfaces)”
NameTypeConstraintMandatoryDefault Value
subinterfacesListsubinterfacesNo
ospfClassospfNo

port_channels (nxos.devices.configuration.interfaces)

Section titled “port_channels (nxos.devices.configuration.interfaces)”
NameTypeConstraintMandatoryDefault Value
ospfClassospfNo

NameTypeConstraintMandatoryDefault Value
ospf_processesListospf_processesNo

loopbacks (nxos.devices.configuration.interfaces)

Section titled “loopbacks (nxos.devices.configuration.interfaces)”
NameTypeConstraintMandatoryDefault Value
ospfClassospfNo

vlans (nxos.devices.configuration.interfaces)

Section titled “vlans (nxos.devices.configuration.interfaces)”
NameTypeConstraintMandatoryDefault Value
ospfClassospfNo

subinterfaces (nxos.devices.configuration.interfaces.ethernets)

Section titled “subinterfaces (nxos.devices.configuration.interfaces.ethernets)”
NameTypeConstraintMandatoryDefault Value
ospfClassospfNo

ospf_processes (nxos.devices.configuration.routing)

Section titled “ospf_processes (nxos.devices.configuration.routing)”
NameTypeConstraintMandatoryDefault Value
nameStringYes
shutdownBooleantrue, falseNo
auto_cost_reference_bandwidthIntegermin: 0, max: 4294967295No
auto_cost_reference_bandwidth_unitChoicembps, gbpsNo
bfdBooleantrue, falseNo
capability_vrf_liteChoicel3vpn, evpnNo
default_metricIntegermin: 0, max: 16777214No
passive_interface_defaultBooleantrue, falseNo
default_route_nssa_abr_pbit_clearBooleantrue, falseNo
discard_route_externalBooleantrue, falseNo
discard_route_internalBooleantrue, falseNo
distanceIntegermin: 1, max: 255No
down_bit_ignoreBooleantrue, falseNo
log_adjacency_changesChoicenone, brief, detailNo
maximum_pathsIntegermin: 1, max: 64No
name_lookupBooleantrue, falseNo
name_lookup_use_vrfStringNo
rfc1583compatibilityBooleantrue, falseNo
router_idIPNo
default_information_originateBooleantrue, falseNo
default_information_originate_alwaysBooleantrue, falseNo
default_information_originate_route_mapStringNo
graceful_restartBooleantrue, falseNo
graceful_restart_grace_periodIntegermin: 5, max: 1800No
graceful_restart_helper_disableBooleantrue, falseNo
graceful_restart_planned_onlyBooleantrue, falseNo
timers_throttle_spf_start_timeIntegermin: 1, max: 600000No
timers_throttle_spf_hold_timeIntegermin: 1, max: 600000No
timers_throttle_spf_max_timeIntegermin: 1, max: 600000No
timers_throttle_lsa_start_timeIntegermin: 0, max: 5000No
timers_throttle_lsa_hold_timeIntegermin: 50, max: 30000No
timers_throttle_lsa_max_timeIntegermin: 50, max: 30000No
timers_lsa_arrivalIntegermin: 10, max: 600000No
timers_lsa_group_pacingIntegermin: 1, max: 1800No
max_metric_router_lsaClassmax_metric_router_lsaNo
areasListareasNo
redistributionsListredistributionsNo
summary_addressesListsummary_addressesNo
vrfsListvrfsNo

ospf_processes (nxos.devices.configuration.routing)

Section titled “ospf_processes (nxos.devices.configuration.routing)”
NameTypeConstraintMandatoryDefault Value
nameStringYes
shutdownBooleantrue, falseNo
auto_cost_reference_bandwidthIntegermin: 0, max: 4294967295No
auto_cost_reference_bandwidth_unitChoicembps, gbpsNo
bfdBooleantrue, falseNo
capability_vrf_liteChoicel3vpn, evpnNo
default_metricIntegermin: 0, max: 16777214No
passive_interface_defaultBooleantrue, falseNo
default_route_nssa_abr_pbit_clearBooleantrue, falseNo
discard_route_externalBooleantrue, falseNo
discard_route_internalBooleantrue, falseNo
distanceIntegermin: 1, max: 255No
down_bit_ignoreBooleantrue, falseNo
log_adjacency_changesChoicenone, brief, detailNo
maximum_pathsIntegermin: 1, max: 64No
name_lookupBooleantrue, falseNo
name_lookup_use_vrfStringNo
rfc1583compatibilityBooleantrue, falseNo
router_idIPNo
max_metric_router_lsaClassmax_metric_router_lsaNo
areasListareasNo
redistributionsListredistributionsNo
vrfsListvrfsNo

ospf (nxos.devices.configuration.interfaces.loopbacks)

Section titled “ospf (nxos.devices.configuration.interfaces.loopbacks)”
NameTypeConstraintMandatoryDefault Value
processStringYes
advertise_secondariesBooleantrue, falseNo
advertise_subnetBooleantrue, falseNo
areaAnyIP or Integer[min: 0, max: 4294967295]No
bfdBooleantrue, falseNo
costIntegermin: 0, max: 65535No
dead_intervalIntegermin: 0, max: 65535No
hello_intervalIntegermin: 0, max: 65535No
mtu_ignoreBooleantrue, falseNo
networkChoicepoint-to-point, broadcastNo
prefix_attributes_n_flag_clearChoiceunspecified, clearNo
passive_interfaceBooleantrue, falseNo
priorityIntegermin: 0, max: 255No
retransmit_intervalIntegermin: 1, max: 65535No
transmit_delayIntegermin: 1, max: 450No
authentication_keyStringNo
message_digest_key_idIntegermin: 0, max: 255No
authentication_key_secure_modeBooleantrue, falseNo
authentication_key_chainStringNo
message_digest_keyStringNo
message_digest_key_secure_modeBooleantrue, falseNo
authenticationChoicesimple, md5, noneNo

max_metric_router_lsa (nxos.devices.configuration.routing.ospf_processes)

Section titled “max_metric_router_lsa (nxos.devices.configuration.routing.ospf_processes)”
NameTypeConstraintMandatoryDefault Value
on_startup_wait_for_bgpStringNo
external_lsaBooleantrue, falseNo
external_lsa_max_metricIntegermin: 0, max: 16777215No
include_stubBooleantrue, falseNo
summary_lsaBooleantrue, falseNo
summary_lsa_max_metricIntegermin: 0, max: 16777215No
on_startupBooleantrue, falseNo
on_startup_timeoutIntegermin: 0, max: 4294967295No

areas (nxos.devices.configuration.routing.ospf_processes)

Section titled “areas (nxos.devices.configuration.routing.ospf_processes)”
NameTypeConstraintMandatoryDefault Value
idAnyIP or Integer[min: 0, max: 4294967295]Yes
authenticationChoicesimple, message-digestNo
default_costIntegermin: 0, max: 16777215No
nssa_no_redistributionBooleantrue, falseNo
no_summaryBooleantrue, falseNo
nssa_translate_type7Choicealways, candidate, neverNo
segment_routing_mplsBooleantrue, falseNo
nssa_translate_type7_suppress_faBooleantrue, falseNo
typeChoiceregular, stub, nssaNo
rangesListrangesNo

areas (nxos.devices.configuration.routing.ospf_processes)

Section titled “areas (nxos.devices.configuration.routing.ospf_processes)”
NameTypeConstraintMandatoryDefault Value
idAnyIP or Integer[min: 0, max: 4294967295]Yes
authenticationChoicesimple, message-digestNo
default_costIntegermin: 0, max: 16777215No
nssa_no_redistributionBooleantrue, falseNo
no_summaryBooleantrue, falseNo
nssa_translate_type7Choicealways, candidate, neverNo
segment_routing_mplsBooleantrue, falseNo
nssa_translate_type7_suppress_faBooleantrue, falseNo
typeChoiceregular, stub, nssaNo

redistributions (nxos.devices.configuration.routing.ospf_processes)

Section titled “redistributions (nxos.devices.configuration.routing.ospf_processes)”
NameTypeConstraintMandatoryDefault Value
protocolChoicestatic, direct, bgp, isis, ospf, ospfv3, eigrp, host, rip, amt, lisp, hmm, am, dhcpv6, icmpv6Yes
protocol_instanceStringNo
asnAnyString or Integer[min: 0, max: 4294967295]No
route_mapStringNo

summary_addresses (nxos.devices.configuration.routing.ospf_processes)

Section titled “summary_addresses (nxos.devices.configuration.routing.ospf_processes)”
NameTypeConstraintMandatoryDefault Value
prefixIPYes
not_advertiseBooleantrue, falseNo
tagIntegermin: 0, max: 4294967295No

vrfs (nxos.devices.configuration.routing.ospf_processes)

Section titled “vrfs (nxos.devices.configuration.routing.ospf_processes)”
NameTypeConstraintMandatoryDefault Value
vrfStringYes
shutdownBooleantrue, falseNo
auto_cost_reference_bandwidthIntegermin: 0, max: 4294967295No
auto_cost_reference_bandwidth_unitChoicembps, gbpsNo
bfdBooleantrue, falseNo
capability_vrf_liteChoicel3vpn, evpnNo
default_metricIntegermin: 0, max: 16777214No
passive_interface_defaultBooleantrue, falseNo
default_route_nssa_abr_pbit_clearBooleantrue, falseNo
discard_route_externalBooleantrue, falseNo
discard_route_internalBooleantrue, falseNo
distanceIntegermin: 1, max: 255No
down_bit_ignoreBooleantrue, falseNo
log_adjacency_changesChoicenone, brief, detailNo
maximum_pathsIntegermin: 1, max: 64No
name_lookupBooleantrue, falseNo
name_lookup_use_vrfStringNo
rfc1583compatibilityBooleantrue, falseNo
router_idIPNo
default_information_originateBooleantrue, falseNo
default_information_originate_alwaysBooleantrue, falseNo
default_information_originate_route_mapStringNo
graceful_restartBooleantrue, falseNo
graceful_restart_grace_periodIntegermin: 5, max: 1800No
graceful_restart_helper_disableBooleantrue, falseNo
graceful_restart_planned_onlyBooleantrue, falseNo
timers_throttle_spf_start_timeIntegermin: 1, max: 600000No
timers_throttle_spf_hold_timeIntegermin: 1, max: 600000No
timers_throttle_spf_max_timeIntegermin: 1, max: 600000No
timers_throttle_lsa_start_timeIntegermin: 0, max: 5000No
timers_throttle_lsa_hold_timeIntegermin: 50, max: 30000No
timers_throttle_lsa_max_timeIntegermin: 50, max: 30000No
timers_lsa_arrivalIntegermin: 10, max: 600000No
timers_lsa_group_pacingIntegermin: 1, max: 1800No
max_metric_router_lsaClassmax_metric_router_lsaNo
areasListareasNo
redistributionsListredistributionsNo
summary_addressesListsummary_addressesNo

vrfs (nxos.devices.configuration.routing.ospf_processes)

Section titled “vrfs (nxos.devices.configuration.routing.ospf_processes)”
NameTypeConstraintMandatoryDefault Value
vrfStringYes
shutdownBooleantrue, falseNo
auto_cost_reference_bandwidthIntegermin: 0, max: 4294967295No
auto_cost_reference_bandwidth_unitChoicembps, gbpsNo
bfdBooleantrue, falseNo
capability_vrf_liteChoicel3vpn, evpnNo
default_metricIntegermin: 0, max: 16777214No
passive_interface_defaultBooleantrue, falseNo
default_route_nssa_abr_pbit_clearBooleantrue, falseNo
discard_route_externalBooleantrue, falseNo
discard_route_internalBooleantrue, falseNo
distanceIntegermin: 1, max: 255No
down_bit_ignoreBooleantrue, falseNo
log_adjacency_changesChoicenone, brief, detailNo
maximum_pathsIntegermin: 1, max: 64No
name_lookupBooleantrue, falseNo
name_lookup_use_vrfStringNo
rfc1583compatibilityBooleantrue, falseNo
router_idIPNo
max_metric_router_lsaClassmax_metric_router_lsaNo
areasListareasNo
redistributionsListredistributionsNo

ranges (nxos.devices.configuration.routing.ospf_processes.areas)

Section titled “ranges (nxos.devices.configuration.routing.ospf_processes.areas)”
NameTypeConstraintMandatoryDefault Value
prefixIPYes
not_advertiseBooleantrue, falseNo
costIntegermin: 0, max: 16777215No

Example 1: Basic OSPF underlay for spine-leaf fabric with loopback and P2P links

nxos:
devices:
- name: LEAF1
configuration:
routing:
ospf_processes:
- name: "1"
router_id: 10.1.100.3
areas:
- id: 0.0.0.0
interfaces:
loopbacks:
- id: 0
ospf:
process: "1"
area: 0.0.0.0
- id: 1
ospf:
process: "1"
area: 0.0.0.0
ethernets:
- id: 1/1
ospf:
process: "1"
area: 0.0.0.0
network: point-to-point
- id: 1/2
ospf:
process: "1"
area: 0.0.0.0
network: point-to-point

Example 2: OSPF with BFD, tuned timers, and passive interfaces

nxos:
devices:
- name: SPINE1
configuration:
routing:
ospf_processes:
- name: "1"
router_id: 10.1.100.1
bfd: true
log_adjacency_changes: detail
areas:
- id: 0.0.0.0
interfaces:
loopbacks:
- id: 0
ospf:
process: "1"
area: 0.0.0.0
- id: 100
ospf:
process: "1"
area: 0.0.0.0
ethernets:
- id: 1/1
ospf:
process: "1"
area: 0.0.0.0
network: point-to-point
hello_interval: 3
dead_interval: 12
- id: 1/2
ospf:
process: "1"
area: 0.0.0.0
network: point-to-point
hello_interval: 3
dead_interval: 12

Example 3: Multi-area OSPF with stub area and max-metric for maintenance

nxos:
devices:
- name: BORDER-LEAF1
configuration:
routing:
ospf_processes:
- name: "1"
router_id: 10.1.100.3
log_adjacency_changes: brief
maximum_paths: 8
rfc1583compatibility: false
max_metric_router_lsa:
on_startup: true
on_startup_timeout: 600
external_lsa: true
summary_lsa: true
areas:
- id: 0.0.0.0
- id: 0.0.0.10
type: stub
default_cost: 10
no_summary: true

Example 4: OSPF in a VRF with passive-interface default and interface overrides

nxos:
devices:
- name: LEAF1
configuration:
routing:
ospf_processes:
- name: "1"
router_id: 10.1.100.3
areas:
- id: 0.0.0.0
- name: "100"
vrfs:
- vrf: BLUE
router_id: 10.1.100.3
passive_interface_default: true
auto_cost_reference_bandwidth: 100
auto_cost_reference_bandwidth_unit: gbps
areas:
- id: 0.0.0.0
interfaces:
vlans:
- id: 1010
vrf: BLUE
ospf:
process: "100"
area: 0.0.0.0
passive_interface: false

Example 5: OSPF with route redistribution

nxos:
devices:
- name: BORDER1
configuration:
routing:
ospf_processes:
- name: "1"
router_id: 10.1.100.5
areas:
- id: 0.0.0.0
redistributions:
- protocol: static
route_map: STATIC_TO_OSPF
- protocol: direct
route_map: DIRECT_TO_OSPF
- protocol: bgp
asn: "65000"
route_map: BGP_TO_OSPF

Example 6: OSPF in VRF with redistributions

nxos:
devices:
- name: LEAF1
configuration:
routing:
ospf_processes:
- name: "100"
vrfs:
- vrf: TENANT_A
router_id: 10.1.100.3
areas:
- id: 0.0.0.0
redistributions:
- protocol: direct
route_map: DIRECT_TO_OSPF
- protocol: bgp
asn: "65001"
route_map: BGP_TO_OSPF_VRF

Example 7: OSPF with SPF/LSA throttling, graceful restart, default route origination, and summarization

nxos:
devices:
- name: BORDER1
configuration:
routing:
ospf_processes:
- name: "1"
router_id: 10.1.100.5
default_information_originate: true
default_information_originate_always: true
default_information_originate_route_map: DEFAULT_TO_OSPF
graceful_restart: true
graceful_restart_planned_only: true
graceful_restart_grace_period: 120
timers_throttle_spf_start_time: 50
timers_throttle_spf_hold_time: 100
timers_throttle_spf_max_time: 5000
timers_throttle_lsa_start_time: 50
timers_throttle_lsa_hold_time: 100
timers_throttle_lsa_max_time: 5000
timers_lsa_arrival: 100
timers_lsa_group_pacing: 20
areas:
- id: 0.0.0.0
- id: 0.0.0.10
ranges:
- prefix: 10.10.0.0/16
cost: 10
- prefix: 10.11.0.0/16
not_advertise: true
summary_addresses:
- prefix: 172.16.0.0/12
tag: 100
- prefix: 192.168.0.0/16
not_advertise: true

Example 8: Point-to-point fabric uplink with OSPF key chain authentication

nxos:
devices:
- name: BORDER-LEAF1
configuration:
feature:
ospf: true
key_chains:
- name: OSPF-UNDERLAY-AUTH
keys:
- id: 1
key_string: OspfKey1
routing:
ospf_processes:
- name: "1"
areas:
- id: 0.0.0.0
interfaces:
ethernets:
- id: 1/48
switchport:
enabled: false
ip:
address: 10.1.10.0/31
ospf:
process: "1"
area: 0.0.0.0
network: point-to-point
authentication: md5
authentication_key_chain: OSPF-UNDERLAY-AUTH

Example 1: Basic OSPF underlay for spine-leaf fabric with loopback and P2P links

nxos:
devices:
- name: LEAF1
configuration:
routing:
ospf_processes:
- name: "1"
router_id: 10.1.100.3
areas:
- id: 0.0.0.0
interfaces:
loopbacks:
- id: 0
ospf:
process: "1"
area: 0.0.0.0
- id: 1
ospf:
process: "1"
area: 0.0.0.0
ethernets:
- id: 1/1
ospf:
process: "1"
area: 0.0.0.0
network: p2p
- id: 1/2
ospf:
process: "1"
area: 0.0.0.0
network: p2p

Example 2: OSPF with BFD, tuned timers, and passive interfaces

nxos:
devices:
- name: SPINE1
configuration:
routing:
ospf_processes:
- name: "1"
router_id: 10.1.100.1
bfd: true
log_adjacency_changes: detail
areas:
- id: 0.0.0.0
interfaces:
loopbacks:
- id: 0
ospf:
process: "1"
area: 0.0.0.0
- id: 100
ospf:
process: "1"
area: 0.0.0.0
ethernets:
- id: 1/1
ospf:
process: "1"
area: 0.0.0.0
network: p2p
hello_interval: 3
dead_interval: 12
- id: 1/2
ospf:
process: "1"
area: 0.0.0.0
network: p2p
hello_interval: 3
dead_interval: 12

Example 3: Multi-area OSPF with stub area and max-metric for maintenance

nxos:
devices:
- name: BORDER-LEAF1
configuration:
routing:
ospf_processes:
- name: "1"
router_id: 10.1.100.3
log_adjacency_changes: brief
maximum_paths: 8
rfc1583compatibility: false
max_metric_router_lsa:
on_startup: true
on_startup_timeout: 600
external_lsa: true
summary_lsa: true
areas:
- id: 0.0.0.0
- id: 0.0.0.10
type: stub
default_cost: 10
no_summary: true

Example 4: OSPF in a VRF with passive-interface default and interface overrides

nxos:
devices:
- name: LEAF1
configuration:
routing:
ospf_processes:
- name: "1"
router_id: 10.1.100.3
areas:
- id: 0.0.0.0
- name: "100"
vrfs:
- vrf: BLUE
router_id: 10.1.100.3
passive_interface_default: true
auto_cost_reference_bandwidth: 100
auto_cost_reference_bandwidth_unit: gbps
areas:
- id: 0.0.0.0
interfaces:
vlans:
- id: 1010
vrf: BLUE
ospf:
process: "100"
area: 0.0.0.0
passive_interface: disabled

Example 5: OSPF with route redistribution

nxos:
devices:
- name: BORDER1
configuration:
routing:
ospf_processes:
- name: "1"
router_id: 10.1.100.5
areas:
- id: 0.0.0.0
redistributions:
- protocol: static
route_map: STATIC_TO_OSPF
- protocol: direct
route_map: DIRECT_TO_OSPF
- protocol: bgp
asn: "65000"
route_map: BGP_TO_OSPF

Example 6: OSPF in VRF with redistributions

nxos:
devices:
- name: LEAF1
configuration:
routing:
ospf_processes:
- name: "100"
vrfs:
- vrf: TENANT_A
router_id: 10.1.100.3
areas:
- id: 0.0.0.0
redistributions:
- protocol: direct
route_map: DIRECT_TO_OSPF
- protocol: bgp
asn: "65001"
route_map: BGP_TO_OSPF_VRF