NetworkingCCNA

OSPF Routing Protocol Explained for CCNA

Static routes break the moment a link goes down and nobody updates the config. OSPF fixes this by letting routers automatically learn the network topology, share that information with each other, and recalculate the best path whenever something changes. It is the most widely deployed interior routing protocol in enterprise networks, and it appears on virtually every CCNA exam. What you need to understand is how OSPF routers form neighbors, what information they share, how they choose paths, and why a broken neighbor adjacency is the first thing to check when routes are missing.

9 min
3 sections · 6 exam key points
5 practice questions

How OSPF neighbors form and share information

OSPF routers discover each other by sending Hello packets to the multicast address 224.0.0.5. Before two routers will exchange routing information, they have to form a neighbor relationship. This requires matching Hello and Dead intervals, the same Area ID, the same subnet, compatible authentication settings, and matching MTU on some platforms. If any of these do not match, OSPF stays stuck at Init or Two-Way and never progresses to Full.

Once neighbors are fully adjacent, they flood Link State Advertisements (LSAs) across the area. Each LSA describes a piece of the topology: which networks a router is connected to, what the cost is, and who the neighbors are. Every router collects all the LSAs and builds an identical Link State Database (LSDB). From that database, each router runs the Dijkstra shortest path first (SPF) algorithm to calculate the lowest-cost path to every destination.

Cost is the metric OSPF uses to choose paths. By default, Cisco calculates cost as 10^8 (100,000,000) divided by the interface bandwidth in bits per second. A 100 Mbps link has a cost of 1. A 10 Mbps link has a cost of 10. This default breaks on links faster than 100 Mbps because they all get cost 1. Fix this by setting the reference bandwidth to match your fastest link: auto-cost reference-bandwidth 1000 for a 1 Gbps network.

Areas, DR/BDR election, and route types

OSPF organizes routers into areas to limit the scope of LSA flooding. All OSPF networks must include Area 0, the backbone area. Other areas connect to Area 0 through Area Border Routers (ABRs). This hierarchy keeps the LSDB small and SPF calculations fast in large networks.

On broadcast networks like Ethernet, OSPF elects a Designated Router (DR) and Backup Designated Router (BDR) to reduce the volume of LSA traffic. Instead of every router forming a full adjacency with every other router, all routers form adjacencies only with the DR and BDR. The DR and BDR communicate with non-designated routers at 224.0.0.6. Election: highest OSPF priority wins (default 1, range 0-255, priority 0 means never a DR). Tie goes to highest Router ID.

Route types in OSPF output: O is an intra-area route (same area). O IA is an inter-area route (learned through an ABR from another area). O E1 or O E2 are external routes redistributed into OSPF. On the CCNA, knowing O versus O IA is usually enough.

How to choose the correct answer

OSPF neighbor not forming: check Hello/Dead interval match, same area, same subnet, no authentication mismatch, matching MTU.

Route not appearing: verify OSPF is active on the correct interface (check passive-interface settings), check area configuration, confirm neighbor adjacency is Full.

Path selection: OSPF chooses the path with the lowest cumulative cost. If a faster path exists but OSPF ignores it, check that reference-bandwidth is consistent across all routers.

DR election: highest priority wins. Priority 0 means the router will never be DR or BDR. Ties go to highest Router ID (often the highest loopback IP).

O in routing table = intra-area OSPF. O IA = inter-area. O E2 = external, cost does not accumulate. O E1 = external, cost accumulates.

OSPF neighbor states

StateMeaning
DownNo Hellos received yet
InitHello received but router's own ID not in the Hello
Two-WayBidirectional communication established; DR/BDR election happens here
ExStartEstablishing master/slave and initial sequence number
ExchangeSharing Database Description (DBD) packets
LoadingRequesting missing LSAs with LSR packets
FullLSDB synchronized; adjacency complete

Key exam facts — CCNA

  • OSPF metric = cost. Default: 10^8 / bandwidth. Fix for fast links: auto-cost reference-bandwidth.
  • Neighbor requirements: same Hello/Dead timers, same area, same subnet, matching auth, compatible MTU.
  • DR/BDR election: highest priority wins (default 1). Priority 0 = never DR. Tie = highest Router ID.
  • All OSPF areas must connect to Area 0. ABR connects multiple areas.
  • O = intra-area. O IA = inter-area. O E2 = external (fixed cost). O E1 = external (accumulating cost).
  • Full adjacency required for routing information exchange. Two-Way is not enough for non-DR/BDR routers.

Common exam traps

OSPF uses hop count as its metric.

OSPF uses cost, which is based on bandwidth. Lower bandwidth links have higher cost. Hop count is the metric used by RIP, not OSPF.

Two-Way state means the OSPF adjacency is complete.

Two-Way means bidirectional communication is established and DR/BDR election can occur. Full adjacency, where LSDBs are synchronized, is required before routing information is actually exchanged.

OSPF requires every router to have the same LSDB as every other router globally.

OSPF LSDBs are scoped to areas. Routers in the same area share the same LSDB. Routers in different areas have different LSDBs and learn about other areas through summary LSAs from ABRs.

Practice questions — OSPF

These questions are representative of what you will see on CCNA exams. The correct answer and explanation are shown immediately below each question.

Q1.Two OSPF routers are directly connected but their neighbor relationship is stuck in the EXSTART state. What is the most likely cause?

A.Mismatched Hello and Dead intervals
B.Mismatched MTU sizes on the connecting interfaces
C.Different OSPF area IDs
D.Different router priorities

Explanation: ExStart is where OSPF negotiates the master/slave relationship and initial DBD sequence numbers. An MTU mismatch causes DBD packets to be dropped, stalling the process at ExStart/Exchange. Mismatched Hello/Dead intervals prevent reaching Two-Way. Area ID mismatch prevents reaching Init/Two-Way. Priority affects DR election, not neighbor state progression.

Q2.An OSPF router shows route O IA 10.2.0.0/24 in its routing table. What does this indicate?

A.The route was redistributed from an external routing protocol
B.The route is an intra-area OSPF route in the same area
C.The route was learned from another OSPF area via an ABR
D.The route was learned via a default route

Explanation: O IA means OSPF Inter-Area — the route was learned from a different OSPF area via an Area Border Router. O (without IA) indicates intra-area routes. O E1 or O E2 indicate external routes redistributed into OSPF. O*E2 indicates an external default route.

Q3.All routers in an OSPF network have the default reference bandwidth. A Gigabit Ethernet interface and a 100 Mbps interface both appear in the SPF calculation. What is the OSPF cost of the GigE interface?

A.1
B.10
C.100
D.1000

Explanation: The default OSPF cost formula is 10^8 / bandwidth in bps. For a 1 Gbps interface: 100,000,000 / 1,000,000,000 = 0.1, which rounds to 1. For 100 Mbps: 100,000,000 / 100,000,000 = 1. Both get cost 1 by default, which is why the reference bandwidth must be raised on networks with interfaces faster than 100 Mbps.

Q4.On an Ethernet segment with five OSPF routers, which routers form Full adjacencies with each other?

A.All five routers form Full adjacency with every other router
B.Only the DR and BDR form Full adjacency; DROthers only reach Two-Way with each other
C.Only the router with the highest priority forms Full adjacency with all others
D.OSPF does not form Full adjacency on Ethernet; it remains at Loading

Explanation: On multi-access networks like Ethernet, OSPF elects a DR and BDR. All DROther routers form Full adjacency with the DR and BDR only. DROther routers see each other in Two-Way state but never reach Full adjacency with each other. This reduces the number of adjacencies from n(n-1)/2 to 2(n-2) + 1.

Q5.A network engineer configures 'ip ospf priority 0' on a router's Ethernet interface. What is the effect?

A.The router becomes the DR for that segment
B.The router can never become the DR or BDR on that segment
C.The router's OSPF cost is set to zero on that interface
D.The router stops sending OSPF Hello packets on that interface

Explanation: OSPF priority 0 means the router explicitly removes itself from DR/BDR election. It will never become a DR or BDR on that segment. This is useful for routers that lack the resources to handle DR responsibilities, such as low-end access routers.

Frequently asked questions — OSPF

What prevents two OSPF routers from becoming neighbors?

OSPF neighbor formation requires: matching Hello and Dead intervals, the same Area ID on the connecting interface, the same subnet, compatible authentication settings, and (on some platforms) matching MTU. If routers are stuck in Down or Init state, check these parameters with 'show ip ospf interface' and 'debug ip ospf adj'.

What is the OSPF DR and why does it matter?

The Designated Router (DR) is elected on multi-access networks (like Ethernet) to reduce OSPF flooding overhead. Instead of every router forming Full adjacency with every other router (which scales as n-squared), all routers form adjacency only with the DR and BDR. The DR collects LSAs and distributes them to all routers on the segment. Election: highest OSPF priority wins (default 1, 0 = never elected). Tie goes to highest Router ID.

What is the difference between OSPF O and O IA routes?

O routes are intra-area — the destination is in the same OSPF area as the router learning the route. O IA routes are inter-area — the destination is in a different OSPF area, and the route was learned through an ABR. O E1 and O E2 are external routes redistributed into OSPF from another routing protocol or static route.

How does OSPF calculate path cost and when should I change the reference bandwidth?

OSPF cost = 10^8 / interface bandwidth in bps. The default reference bandwidth is 100 Mbps (10^8). Any interface at or above 100 Mbps gets cost 1, making GigE and 10GigE appear equal. Change the reference bandwidth with 'auto-cost reference-bandwidth <value>' (in Mbps) on all routers consistently — typically 1000 for GigE networks or 10000 for 10GigE.

How is OSPF tested on the CCNA exam?

CCNA OSPF questions cover neighbor formation prerequisites, DR/BDR election, route types (O vs O IA vs O E2), cost calculation and path selection, troubleshooting adjacency failures, and the role of Area 0 and ABRs in multi-area OSPF. Expect both conceptual questions and simulation-style questions where you identify why two routers won't become neighbors.

Practice this topic

Test yourself on OSPF

JT Exams routes you to questions in your exact weak areas — automatically, after every session.

No credit card · Cancel anytime

Related certification topics