All topic guides
Routing

OSPF & OSPFv3

Link-state operation, neighbors, LSAs, single-area OSPF, and OSPFv3 for IPv6.

How the sources were combined

jdepew88 OSPF and OSPFv3 markdown files are the depth source. No Panagiss OSPF file — amalgam adds study-chart cross-refs and Jeremy's IT Lab OSPF sequence alignment.

Overview

OSPF is the primary CCNA dynamic routing protocol — link-state operation, neighbor adjacencies, DR/BDR on multi-access segments, and single-area configuration. OSPFv3 extends the same logic to IPv6.

OSPF at a glance

Open Shortest Path First (OSPF) is a link-state IGP. Each router describes its links in link-state advertisements (LSAs), floods them within an area, and every router builds the same link-state database (LSDB). Each router then runs Shortest Path First (SPF / Dijkstra) to compute best paths.

  • Layer 3 protocol — rides directly on IP, protocol 89 (not TCP/UDP)
  • Metric: cost (lower is better); default reference bandwidth 100 Mbps
  • Administrative distance: 110
  • Multicast: All OSPF routers 224.0.0.5; DR/BDR 224.0.0.6
Info

Link = router interface. State = description of that interface and its relationship to neighbors (IP, mask, network type, attached routers). All link states form the LSDB.

OSPF packet types

TypeNamePurpose
1HelloDiscover/maintain neighbors; carry timer/area/auth/stub flags
2DBD (Database Description)Summary of LSAs in LSDB
3LSR (Link State Request)Request full LSA details
4LSU (Link State Update)Carries LSAs (often response to LSR)
5LSAckAcknowledges LSU

Hello timers (defaults):

Network typeHelloDead
Broadcast / Point-to-Point10 sec40 sec
NBMA / Point-to-Multipoint30 sec120 sec

Dead interval = 4 × hello (IOS adjusts dead automatically when hello changes).

Neighbor adjacency requirements

Hello parameters must match for adjacency:

  • Hello and dead intervals
  • Area ID
  • Authentication (if configured)
  • Stub area flag
  • Subnet on the link (same network)

Bi-directional communication is confirmed when a router sees its own Router ID in a neighbor's Hello.

OSPF States

Neighbor state machine — Down through Full.

From study charts · jdepew88 CCNA notes

OSPF Adj

Key fields in show ip ospf neighbor output.

From study charts · jdepew88 CCNA notes

OSPF Packet Anatomy - 24 Octets

OSPF 24-byte common header.

From study charts · jdepew88 CCNA notes

Router ID and process ID

Router ID (RID): 32-bit dotted decimal identifying the router in OSPF.

  1. Manually configured router-id
  2. Highest loopback IP (if any)
  3. Highest active physical interface IP when OSPF starts

Best practice: set a loopback or manual RID so an interface flap does not change identity.

Process ID: 1–65535, locally significant — does not need to match neighbors. Allows multiple OSPF processes on one router (uncommon at CCNA).

Router ID and single-area OSPF

router ospf 1 router-id 1.1.1.1 network 10.0.0.0 0.255.255.255 area 0

Modern alternative — enable OSPF per interface:

interface GigabitEthernet0/0
 ip ospf 1 area 0
 ip ospf cost 10
Wildcard mask in network statement

OSPF network uses a wildcard mask, not a subnet mask. network 192.168.1.0 0.0.0.255 area 0 enables OSPF on interfaces in 192.168.1.0/24.

Single-area design (CCNA focus)

Area 0 is the OSPF backbone. CCNA labs typically place all routers in Area 0 only — still know that multi-area designs require every non-backbone area to connect through Area 0.

Cisco recommends ≤ ~50 routers per area for scalability. Multi-area designs use ABRs (Area Border Routers) for summarization and reduced LSA flooding.

DR/BDR on multi-access segments

On broadcast (Ethernet) and NBMA networks, OSPF elects a Designated Router (DR) and Backup DR (BDR) to reduce LSA flooding.

  • DROTHER routers form FULL adjacency only with DR and BDR — not with each other (2-WAY state between DROTHERs)
  • Point-to-point links (serial HDLC/PPP): no DR/BDR election
  • Election per segment, not per router globally

Election criteria:

  1. Highest priority (1–255; default 1; 0 = ineligible for DR/BDR)
  2. Highest Router ID if priority ties

Non-preemptive by default: Changing priority after election does not displace the current DR until OSPF process reset on segment.

OSPF Path Cost

Default OSPF cost by interface bandwidth.

From study charts · jdepew88 CCNA notes

Cost formula: cost = reference bandwidth ÷ interface bandwidth (default reference = 10⁸ bps = 100 Mbps).

auto-cost reference-bandwidth 1000

Adjust on all routers when Gigabit+ links make default costs misleading.

interface GigabitEthernet0/0
 ip ospf priority 110
 ip ospf cost 50

LSA types (awareness)

TypeNameGenerated by
1Router LSAEvery router — links in area
2Network LSADR on multi-access segment
3Summary LSAABR — routes between areas
4ASBR SummaryABR — path to ASBR
5External LSAASBR — routes from outside OSPF

CCNA single-area labs focus on Type 1 and Type 2.

OSPFv3 (IPv6)

OSPFv3 supports IPv6 prefixes and 128-bit addresses. OSPFv2 and OSPFv3 are independent — they can run simultaneously but do not speak to each other.

FeatureOSPFv2OSPFv3
Address familyIPv4IPv6
Configurationrouter ospf + networkInterface-level ipv6 ospf
Neighbor addressesIPv4 interface IPIPv6 link-local
All-router multicast224.0.0.5FF02::5
DR/BDR multicast224.0.0.6FF02::6
Protocol number8989
Router ID32-bit (IPv4 format)Same 32-bit RID (manual on IPv6-only)
OSPFv3 interface configuration

ipv6 unicast-routing ! interface GigabitEthernet0/0 ipv6 address 2001:db8:1::1/64 ipv6 ospf 1 area 0 ! router ospfv3 1 router-id 1.1.1.1

Tip

Pure IPv6 networks have no IPv4 from which to derive a Router ID — configure router-id explicitly under router ospfv3.

Verification commands

For a lab submission workflow with grouped show commands and an x-remote YAML playbook (multi-router capture), see OSPF CLI Verification.

OSPF verification

show ip ospf neighbor show ip ospf interface brief show ip ospf database show ip ospf lsdb show ip route ospf show ip protocols show ip ospf

Neighbor states to know:

StateMeaning
DOWNNo Hello heard
INITHello seen, not bidirectional
2-WAYBidirectional; DROTHERs stop here on MA
EXSTART/EXCHANGEMaster/slave DBD exchange
LOADINGLSR/LSU for missing LSAs
FULLLSDB synchronized — adjacency complete

Troubleshooting

IssueFirst checks
No neighborSame subnet? Area match? Hello/dead timers? ACL blocking proto 89?
Stuck EXSTARTMTU mismatch on link
Stuck 2-WAYNormal for DROTHERs; problem if DR should be FULL
No OSPF routesnetwork/ip ospf covers interface? Passive interface?
Suboptimal pathManual cost, reference bandwidth, or missing link in topology

show ip ospf neighbor is always the first command — no FULL, no synchronized LSDB.

Exam checklist

Area 0 is the backbone

Even in "single-area" OSPF, that area is Area 0. Multi-area designs require inter-area traffic to transit the backbone.

DR election scope

DR/BDR election happens on multi-access segments only. A router can be DR on one Ethernet segment and DROTHER on another.

Passive interface

passive-interface stops Hellos on an interface — no neighbors form, but the interface network is still advertised if covered by network or not excluded.

Quick review

  • OSPF is link-state: LSAs → LSDB → SPF → routing table
  • Neighbors use multicast 224.0.0.5; DR/BDR use 224.0.0.6
  • DR/BDR reduce LSA floods on Ethernet; P2P links skip election
  • Cost = reference BW ÷ link BW; AD = 110
  • OSPFv3 uses IPv6 link-locals, FF02::5/FF02::6, and interface-level config
  • Verify with show ip ospf neighbor — target state FULL

Related lessons on this site

Continue in this domain

Routing · guide 2 of 4

Sources & further reading

jdepew88 CCNA Notes (markdown)

This page is an amalgamated study guide synthesized from the markdown sources above, cross-checked against Cisco's official CCNA exam topics. Verify scope before your exam date.