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 through a network topology stored in a synchronized link-state database. It provides fast convergence, load balancing across equal-cost paths, and hierarchical network design through area-based segmentation that reduces routing overhead and improves scalability in large networks. OSPF supports advanced features including route summarization, authentication, traffic engineering extensions, and integration with MPLS for comprehensive enterprise and service provider routing solutions.

Diagram
NameTypeConstraintMandatoryDefault Value
ospf_processesList[ospf_processes]No

ospf_processes (iosxe.devices.configuration.routing)

Section titled “ospf_processes (iosxe.devices.configuration.routing)”
NameTypeConstraintMandatoryDefault Value
idIntegermin: 1, max: 65535No
vrfStringNo
bfd_all_interfacesBooleantrue, falseNo
default_information_originateBooleantrue, falseNo
default_information_originate_alwaysBooleantrue, falseNo
default_metricIntegermin: 1, max: 16777214No
distanceIntegermin: 1, max: 255No
domain_tagIntegermin: 1, max: 4294967295No
mpls_ldp_autoconfigBooleantrue, falseNo
mpls_ldp_syncBooleantrue, falseNo
neighborsList[neighbors]No
networksList[networks]No
priorityIntegermin: 0, max: 127No
router_idStringNo
shutdownBooleantrue, falseNo
summary_addressesList[summary_addresses]No
areasList[areas]No
passive_interface_defaultBooleantrue, falseNo
auto_cost_reference_bandwidthIntegermin: 1, max: 4294967No
passive_interfacesList[passive_interfaces]No

neighbors (iosxe.devices.configuration.routing.ospf_processes)

Section titled “neighbors (iosxe.devices.configuration.routing.ospf_processes)”
NameTypeConstraintMandatoryDefault Value
ipIPYes
priorityIntegermin: 0, max: 255No
costIntegermin: 1, max: 65535No

networks (iosxe.devices.configuration.routing.ospf_processes)

Section titled “networks (iosxe.devices.configuration.routing.ospf_processes)”
NameTypeConstraintMandatoryDefault Value
ipIPYes
wildcardStringNo
areaStringNo

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

Section titled “summary_addresses (iosxe.devices.configuration.routing.ospf_processes)”
NameTypeConstraintMandatoryDefault Value
ipIPYes
maskIPNo

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

Section titled “areas (iosxe.devices.configuration.routing.ospf_processes)”
NameTypeConstraintMandatoryDefault Value
idStringYes
authentication_message_digestBooleantrue, falseNo
nssaBooleantrue, falseNo
nssa_default_information_originateBooleantrue, falseNo
nssa_default_information_originate_metricIntegermin: 0, max: 16777214No
nssa_default_information_originate_metric_typeIntegermin: 1, max: 2No
nssa_no_summaryBooleantrue, falseNo
nssa_no_redistributionBooleantrue, falseNo

passive_interfaces (iosxe.devices.configuration.routing.ospf_processes)

Section titled “passive_interfaces (iosxe.devices.configuration.routing.ospf_processes)”
NameTypeConstraintMandatoryDefault Value
interface_typeChoiceLoopback, Vlan, GigabitEthernet, TwoGigabitEthernet, FiveGigabitEthernet, TenGigabitEthernet, TwentyFiveGigabitEthernet, FortyGigabitEthernet, HundredGigabitEthernetNo
interface_idStringNo

By using Dijkstra’s algorithm and area-based segmentation, OSPF provides fast convergence, scalable routing, and robust network design.

Key Components:

  • OSPF Process ID (id): Identifies the OSPF routing process.

  • Router ID (router_id): Sets the unique router ID for the process.

  • Network Statements (networks): Advertises networks into OSPF with IP, wildcard mask, and area.

  • Area Type (areas): Configures area types (normal, stub, NSSA, totally stubby).

  • Interface Cost (neighbors.cost): Sets the cost for OSPF interfaces.

  • Interface Priority (neighbors.priority): Sets the priority for OSPF interfaces.

  • Authentication (areas.authentication_message_digest): Enables OSPF authentication (simple, MD5).

  • Default Information Originate (default_information_originate): Advertises a default route into OSPF.

  • Route Summarization (summary_addresses): Configures inter-area and external route summarization.

  • Administrative Distance (distance): Sets the OSPF administrative distance.

  • Bidirectional Forwarding Detection (BFD) (bfd_all_interfaces): Enables BFD for OSPF interfaces.

  • Passive Interface (passive_interface_default, passive_interfaces): Configures passive interfaces.

  • Reference Bandwidth (auto_cost_reference_bandwidth): Sets reference bandwidth for auto-cost calculation.

  • VRF Association (vrf): Associates OSPF process with a VRF.

Key Parameters Briefly Explained:

  • id: OSPF process identifier.
  • router_id: Unique router ID.
  • networks: Network statements for OSPF.
  • areas: Area configuration and types.
  • neighbors.cost, neighbors.priority: Interface cost and priority.
  • areas.authentication_message_digest: Authentication settings.
  • default_information_originate: Default route advertisement.
  • summary_addresses: Route summarization.
  • distance: Administrative distance.
  • bfd_all_interfaces: BFD enablement.
  • passive_interface_default, passive_interfaces: Passive interface settings.
  • auto_cost_reference_bandwidth: Reference bandwidth.
  • vrf: VRF association.

You can use these OSPF parameters to design and implement a scalable and efficient routing infrastructure. Customize the process ID, router ID, network statements, area types, and interface settings to fit your network’s topology, performance requirements, and security policies. Adjusting these parameters lets you tailor OSPF’s behavior for optimal route calculation and distribution.

The following configuration describes how to set up OSPF on a Cisco IOS-XE device, including process definition, router ID, network advertisement, area configuration, default route origination, passive interfaces, and VRF association.

router ospf 100
router-id 192.168.1.1
bfd all-interfaces
default-information originate always metric 10
auto-cost reference-bandwidth 10000
network 192.168.1.0 0.0.0.255 area 0
network 10.0.0.0 0.255.255.255 area 1
passive-interface default
no passive-interface GigabitEthernet0/0
passive-interface Vlan100
area 1 authentication message-digest
area 1 nssa default-information-originate metric 100 metric-type 1 no-summary
!
router ospf 200 vrf VRF-PROD
router-id 172.16.1.1
default-metric 20
network 172.16.0.0 0.0.255.255 area 0

The following YAML code defines OSPF configuration on an IOS-XE device, including multiple OSPF processes, VRF association, BFD settings, default route origination, auto-cost reference bandwidth, neighbor configuration, networks, router ID, summary addresses, area types, and passive interface settings.

iosxe:
devices:
- name: Device1
configuration:
routing:
ospf_processes:
- id: 100
vrf: VRF-PROD
bfd_all_interfaces: true
default_information_originate: true
default_information_originate_always: true
default_metric: 10
distance: 120
domain_tag: 10
auto_cost_reference_bandwidth: 10000
neighbors:
- ip: 192.168.1.2
priority: 10
cost: 100
- ip: 192.168.2.2
priority: 5
cost: 50
networks:
- ip: 192.168.1.0
wildcard: 0.0.0.255
area: "0"
- ip: 10.0.0.0
wildcard: 0.255.255.255
area: "1"
router_id: 192.168.1.1
shutdown: false
summary_addresses:
- ip: 10.0.0.0
mask: 255.0.0.0
- ip: 172.16.0.0
mask: 255.240.0.0
areas:
- id: "1"
authentication_message_digest: true
nssa: true
nssa_default_information_originate: true
nssa_default_information_originate_metric: 100
nssa_default_information_originate_metric_type: 1
nssa_no_summary: true
nssa_no_redistribution: true
passive_interface_default: true
passive_interfaces:
- interface_type: GigabitEthernet
interface_id: "0/0/1"
- interface_type: Vlan
interface_id: "100"
- id: 200
bfd_all_interfaces: false
default_metric: 20
auto_cost_reference_bandwidth: 1000
networks:
- ip: 172.16.0.0
wildcard: 0.0.255.255
area: "0"
router_id: 172.16.1.1
passive_interface_default: false