Skip to content
Learni
View all tutorials
Réseaux

How to Configure OSPF on Cisco Routers in 2026

12 minBEGINNER
Lire en français

Introduction

OSPF (Open Shortest Path First) is a widely used link-state dynamic routing protocol in enterprise networks. It calculates the shortest path using Dijkstra's algorithm and quickly adapts to topology changes. This tutorial provides a progressive guide to configuring OSPF on Cisco IOS routers. You will learn how to enable the process, declare networks, and verify convergence. These skills are essential for any beginner network administrator seeking to optimize internal routing.

Prerequisites

  • Cisco router with IOS 15.0 or higher
  • Console or SSH access to the router
  • Basic knowledge of IP addressing and subnet masks
  • Two routers connected via a physical interface

Accessing Configuration Mode

terminal
enable
configure terminal

These commands allow access to privileged mode followed by global configuration mode on the Cisco router.

Enabling the OSPF Process

terminal
router ospf 1
router-id 1.1.1.1

The router ospf 1 command creates the OSPF process with process ID 1. The router-id sets the router's unique identifier.

Declaring OSPF Networks

terminal
network 192.168.1.0 0.0.0.255 area 0
network 10.0.0.0 0.0.0.3 area 0

These commands include the interfaces in OSPF using wildcard masks and place them in backbone area 0.

Configuring the FastEthernet Interface

terminal
interface fastethernet 0/0
ip address 192.168.1.1 255.255.255.0
no shutdown

Assign the IP address and activate the physical interface to enable OSPF hello packet exchange.

Verifying the OSPF Configuration

terminal
show ip ospf neighbor
show ip route ospf

These commands allow verification of formed OSPF neighbors and dynamically learned routes.

Best Practices

  • Always define a stable and unique router-id
  • Use areas to limit LSDB size
  • Configure consistent interface costs
  • Enable MD5 authentication on OSPF links
  • Monitor convergence with appropriate timers

Common Errors

  • Forgetting the network keyword in OSPF configuration
  • Using incorrect wildcard masks
  • Failing to activate interfaces with no shutdown
  • Confusing process ID with area ID

Going Further

Deepen your routing skills with our dedicated network protocol training: https://learni-group.com/formations