3.4 Single-Area OSPFv2 — Concepts

Key Takeaways

  • OSPF is a link-state routing protocol that uses Dijkstra's SPF algorithm to find the shortest path.
  • OSPF uses cost as its metric, calculated as Reference Bandwidth / Interface Bandwidth.
  • The default reference bandwidth is 100 Mbps, making all Gigabit and faster links cost 1.
  • OSPF routers form neighbor adjacencies by exchanging Hello packets (multicast 224.0.0.5).
  • OSPF uses areas for scalability — the CCNA covers single-area OSPF (all interfaces in Area 0).
Last updated: March 2026

Single-Area OSPFv2 — Concepts

OSPF (Open Shortest Path First) is the most commonly used interior gateway protocol (IGP) in enterprise networks. It is an open-standard link-state routing protocol defined in RFC 2328.

Why OSPF?

FeatureOSPFRIPEIGRP
TypeLink-stateDistance-vectorAdvanced distance-vector
StandardOpen (RFC 2328)OpenCisco-proprietary (now open)
MetricCost (bandwidth)Hop count (max 15)Composite (bandwidth + delay)
ConvergenceFastSlowFast
ScalabilityExcellent (with areas)PoorGood
AD11012090
CCNA focusYesMentionedMentioned

On the Exam: OSPF is the primary routing protocol tested on the CCNA. Know configuration, cost calculation, neighbor adjacencies, DR/BDR election, and troubleshooting.

How OSPF Works

Step 1: Discover Neighbors

OSPF routers send Hello packets to discover other OSPF routers on directly connected links.

Step 2: Form Adjacencies

Routers exchange Hello packets and transition through neighbor states to form full adjacencies.

Step 3: Exchange Link-State Information

Routers exchange Link-State Advertisements (LSAs) describing their interfaces and connected networks.

Step 4: Build the LSDB

Each router builds a Link-State Database (LSDB) — a complete map of the network topology. All routers in an area have identical LSDBs.

Step 5: Run SPF Algorithm

Each router runs Dijkstra's Shortest Path First algorithm on the LSDB to calculate the best path to every destination.

Step 6: Build the Routing Table

The SPF results are installed in the routing table.

OSPF Packet Types

TypeNamePurpose
1HelloDiscover and maintain neighbor relationships
2DBD (Database Description)Summary of LSDB contents for synchronization
3LSR (Link-State Request)Request specific LSAs from a neighbor
4LSU (Link-State Update)Contains actual LSAs being sent
5LSAck (Link-State Acknowledgment)Confirms receipt of LSAs

OSPF Cost Calculation

OSPF uses cost as its metric. The formula is:

Cost = Reference Bandwidth / Interface Bandwidth

Default reference bandwidth = 100 Mbps (100,000,000 bps)

Interface SpeedDefault CostIssue
10 Mbps10Correct
100 Mbps (FastEthernet)1Correct
1 Gbps (GigabitEthernet)1Problem — same as FastEthernet!
10 Gbps1Problem — same as FastEthernet!
100 Gbps1Problem — same as FastEthernet!

Fix: Increase the Reference Bandwidth

Router(config-router)# auto-cost reference-bandwidth 10000   ! 10 Gbps reference

With 10 Gbps reference:

Interface SpeedCost
10 Mbps1000
100 Mbps100
1 Gbps10
10 Gbps1

Important: The reference bandwidth must be the same on ALL OSPF routers in the network for consistent cost calculation.

Manually Setting Interface Cost

Router(config-if)# ip ospf cost 5

OSPF Neighbor Requirements

For two OSPF routers to become neighbors, the following must match:

ParameterMust Match?Notes
Area IDYesBoth interfaces must be in the same area
Hello/Dead timersYesDefault: Hello=10s, Dead=40s (broadcast); Hello=30s, Dead=120s (NBMA)
AuthenticationYesIf configured, both sides must use same type and key
Subnet/MaskYesInterfaces must be on the same subnet
MTUYesMismatched MTU prevents full adjacency (stuck in ExStart)
Stub area flagYesBoth must agree on stub/NSSA area type
Router IDNoMust be unique but does not need to match

OSPF Neighbor States

StateDescription
DownNo Hello received from this neighbor
InitHello received but own Router ID not seen in neighbor's Hello
2-WayBidirectional communication confirmed (both see each other's Router ID)
ExStartMaster/slave negotiation for DBD exchange
ExchangeDBD packets exchanged
LoadingLSRs and LSUs exchanged to synchronize LSDBs
FullLSDBs synchronized — full adjacency established

On the Exam: The most important states to understand are 2-Way (where DR/BDR election happens) and Full (complete adjacency). If a neighbor is stuck in ExStart/Exchange, check for MTU mismatch.

OSPF Areas

OSPF uses areas to improve scalability:

  • Area 0 (backbone area): All areas must connect to Area 0
  • Single-area OSPF: All interfaces in Area 0 (CCNA scope)
  • Multi-area OSPF: Different networks in different areas (CCNP scope)

The CCNA exam focuses on single-area OSPF where all router interfaces are in Area 0.

Loading diagram...
OSPF Neighbor Adjacency Formation
Test Your Knowledge

What is the default OSPF cost for a GigabitEthernet interface (using the default reference bandwidth of 100 Mbps)?

A
B
C
D
Test Your Knowledge

Which OSPF packet type is used to discover and maintain neighbor relationships?

A
B
C
D
Test Your Knowledge

What is the OSPF administrative distance?

A
B
C
D