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
Section titled “Diagram”Classes
Section titled “Classes”routing (iosxe.devices.configuration)
Section titled “routing (iosxe.devices.configuration)”Name | Type | Constraint | Mandatory | Default Value |
---|---|---|---|---|
ospf_processes | List | [ospf_processes] | No |
ospf_processes (iosxe.devices.configuration.routing)
Section titled “ospf_processes (iosxe.devices.configuration.routing)”Name | Type | Constraint | Mandatory | Default Value |
---|---|---|---|---|
id | Integer | min: 1 , max: 65535 | No | |
vrf | String | No | ||
bfd_all_interfaces | Boolean | true , false | No | |
default_information_originate | Boolean | true , false | No | |
default_information_originate_always | Boolean | true , false | No | |
default_metric | Integer | min: 1 , max: 16777214 | No | |
distance | Integer | min: 1 , max: 255 | No | |
domain_tag | Integer | min: 1 , max: 4294967295 | No | |
mpls_ldp_autoconfig | Boolean | true , false | No | |
mpls_ldp_sync | Boolean | true , false | No | |
neighbors | List | [neighbors] | No | |
networks | List | [networks] | No | |
priority | Integer | min: 0 , max: 127 | No | |
router_id | String | No | ||
shutdown | Boolean | true , false | No | |
summary_addresses | List | [summary_addresses] | No | |
areas | List | [areas] | No | |
passive_interface_default | Boolean | true , false | No | |
auto_cost_reference_bandwidth | Integer | min: 1 , max: 4294967 | No | |
passive_interfaces | List | [passive_interfaces] | No |
neighbors (iosxe.devices.configuration.routing.ospf_processes)
Section titled “neighbors (iosxe.devices.configuration.routing.ospf_processes)”Name | Type | Constraint | Mandatory | Default Value |
---|---|---|---|---|
ip | IP | Yes | ||
priority | Integer | min: 0 , max: 255 | No | |
cost | Integer | min: 1 , max: 65535 | No |
networks (iosxe.devices.configuration.routing.ospf_processes)
Section titled “networks (iosxe.devices.configuration.routing.ospf_processes)”Name | Type | Constraint | Mandatory | Default Value |
---|---|---|---|---|
ip | IP | Yes | ||
wildcard | String | No | ||
area | String | No |
summary_addresses (iosxe.devices.configuration.routing.ospf_processes)
Section titled “summary_addresses (iosxe.devices.configuration.routing.ospf_processes)”Name | Type | Constraint | Mandatory | Default Value |
---|---|---|---|---|
ip | IP | Yes | ||
mask | IP | No |
areas (iosxe.devices.configuration.routing.ospf_processes)
Section titled “areas (iosxe.devices.configuration.routing.ospf_processes)”Name | Type | Constraint | Mandatory | Default Value |
---|---|---|---|---|
id | String | Yes | ||
authentication_message_digest | Boolean | true , false | No | |
nssa | Boolean | true , false | No | |
nssa_default_information_originate | Boolean | true , false | No | |
nssa_default_information_originate_metric | Integer | min: 0 , max: 16777214 | No | |
nssa_default_information_originate_metric_type | Integer | min: 1 , max: 2 | No | |
nssa_no_summary | Boolean | true , false | No | |
nssa_no_redistribution | Boolean | true , false | No |
passive_interfaces (iosxe.devices.configuration.routing.ospf_processes)
Section titled “passive_interfaces (iosxe.devices.configuration.routing.ospf_processes)”Name | Type | Constraint | Mandatory | Default Value |
---|---|---|---|---|
interface_type | Choice | Loopback , Vlan , GigabitEthernet , TwoGigabitEthernet , FiveGigabitEthernet , TenGigabitEthernet , TwentyFiveGigabitEthernet , FortyGigabitEthernet , HundredGigabitEthernet | No | |
interface_id | String | No |
By using Dijkstra’s algorithm and area-based segmentation, OSPF provides fast convergence, scalable routing, and robust network design.
OSPF Parameters
Section titled “OSPF Parameters”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.
Sample Configuration
Section titled “Sample Configuration”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
Example YAML Code
Section titled “Example YAML Code”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