OSPF (Open Shortest Path First) is a dynamic, link-state interior gateway protocol used within an autonomous system to exchange routing information between routers. It uses cost as its metric, calculated based on interface bandwidth, and ensures loop-free, efficient routing through the Dijkstra Shortest Path First (SPF) algorithm. OSPF organizes routers into areas to optimize scalability and convergence. Routers exchange topology information via LSAs (Link-State Advertisements), allowing each router to build a synchronized link-state database and independently compute the shortest path tree.
Each router is identified by a unique Router ID (RID), which must remain consistent in the OSPF domain. OSPF establishes neighbor relationships through Hello packets and forms adjacencies to exchange routing data. For any two routers to become neighbors, key parameters like area ID, hello/dead intervals, subnet, and authentication (if used) must match. All routers in a single area maintain identical link-state databases, ensuring consistent path selection.
| Router | Interface | IP Address | OSPF Router ID |
|---|---|---|---|
| R1 | Fa0/0 | 192.168.12.1/24 | 1.1.1.1 |
| R2 | Fa0/0 | 192.168.12.2/24 | 2.2.2.2 |
| R2 | Fa0/1 | 192.168.23.2/24 | 2.2.2.2 |
| R3 | Fa0/0 | 192.168.23.3/24 | 3.3.3.3 |
All routers will be in OSPF Area 0.
Neighbor ID: The router ID of the adjacent router (R2)
State: Must reach FULL for full adjacency
Interface: Shows the local interface forming the adjacency
O indicates an OSPF-learned route
Administrative distance = 110, cost = 20
Confirms the Router ID and that OSPF process is running
State: Shows role on each segment (DR, BDR, DROTHER)
Cost: OSPF cost of the interface
Neighbors: Number of OSPF neighbors on that interface
| Mistake | Symptom | Fix |
|---|---|---|
| Not setting router-id | Random IDs from interfaces; confusion in show ip ospf neighbor | Set it manually with router-id |
| Interfaces shutdown | OSPF adjacency never forms | Use no shutdown on interfaces |
| Incorrect wildcard mask | OSPF doesn’t recognize interface | Double-check network command masks |
| Mismatched area IDs | Neighbors stuck in INIT or EXSTART | Ensure all connected interfaces are in same OSPF area |
| Missing network statement | Route or interface not advertised | Include all intended subnets in network commands |
The lab is available for download from this link. Try recreating the sample lab above using the provided IP addressing scheme.
Try the following tasks to prepare for the next lesson:
Configure a loopback interface on each router:
R1: Loopback0 → 10.1.1.1/32
R2: Loopback0 → 10.2.2.2/32
R3: Loopback0 → 10.3.3.3/32
Advertise them in OSPF.
Verify that all loopback networks are visible on R1 using show ip route.