OSPF – Open Shortest Path First (Full
Lecture)
📌 1. What is OSPF?
OSPF = Link-State IGP protocol.
Property Value
Protocol Type Link-State
Standard Open (RFC 2328 for v2)
Metric Cost (based on bandwidth)
Administrative 110
Distance
Classful/Classless Classless (supports VLSM)
Algorithm Dijkstra SPF (Shortest Path
First)
🔥 2. Why OSPF?
Because RIP is ancient trash.
✅ Faster convergence
✅ Scalability
✅ Loop-free (LSDB architecture)
✅ Supports VLSM
✅ Auth, summarization, multi-area = enterprise-ready
🧱 3. OSPF Basic Components
Term Description
Router ID (RID) Unique 32-bit value (like IP) used to identify each OSPF
router
Area Logical grouping of routers
LSA (Link-State OSPF update packet — describes routes
Advertisement)
LSDB Link-State Database — full network map
SPF Tree Dijkstra’s algorithm to calculate shortest path
Cost Metric = 100 Mbps / interface bandwidth
DR/BDR Designated Router & Backup on
broadcast/multi-access networks
🛠️ 4. OSPF Packet Types
Packet Purpose
Type
Hello Discover and maintain
neighbors
DBD Summary of LSAs
LSR Request specific LSAs
LSU Contains LSAs
LSAck Acknowledges LSU packets
🧪 5. OSPF Neighbor Requirements
To form an adjacency, Hello packets must match:
✅ Area ID
✅ Subnet
✅ Hello/Dead timers
✅ Authentication (if configured)
✅ Stub flag
✅ MTU (optional but can cause failure)
🧩 6. Router ID Selection
Order of preference:
1. Manual RID (router-id x.x.x.x)
2. Highest IP on loopback
3. Highest IP on active interface
🔥 Set manually for consistency.
🧱 7. OSPF Network Types
Type DR/B Broadc Exampl
DR ast e
? ?
Broadcast ✅ ✅ Ethernet
Non-Broadcast ✅ ❌ Frame
Rela
y
Point-to-Point ❌ ❌ Serial
Point-to-Multip ❌ ❌ WAN
oint clou
ds
🌐 8. OSPF Areas
Area Type Description
Backbone Core of the OSPF domain
(Area 0)
Regular Standard area
Stub Blocks external routes (type 5 LSAs)
Totally Stubby Blocks type 5 & 3 LSAs
NSSA Allows external routes but blocks type 5 (uses type 7
LSAs)
📦 9. LSA Types (Must-Memorize)
T Name Description
1 Router LSA Sent by every router in an area
2 Network LSA Sent by DRs only
3 Summary LSA Area border routers (ABRs)
4 ASBR Summary Point to ASBR location
LSA
5 External LSA External routes (from other
protocols)
7 NSSA External External routes in NSSA
LSA
⚙️ 10. OSPF Cost Calculation
Cost = 100,000,000 / Interface Bandwidth in bps
Bandwi Cost
dth
10 10
Mbp
s
100 1
Mbp
s
1 Gbps 1 (Cisco
default)
Lower cost = better path
🔐 11. OSPF Authentication (Optional but
Exam-Touched)
Ty Description
p
e
No Default
n
e
Si Clear-text passwords
m (bad)
p
l
e
M Hashed passwords
D (secure)
5
Set using:
bash
CopyEdit
● ip ospf authentication
● ip ospf authentication-key 12345
🚧 12. OSPF Configuration (Single-Area Example)
bash
CopyEdit
● router ospf 1
● router-id 1.1.1.1
● network 192.168.1.0 0.0.0.255 area 0
OR better (interface method):
bash
CopyEdit
● interface g0/0
● ip address 192.168.1.1 255.255.255.0
● ip ospf 1 area 0
🔥 13. CCNA-Level Troubleshooting Commands
Command Purpose
show ip ospf Check adjacency states
neighbor
show ip ospf See OSPF-enabled
interface interfaces
show ip ospf General OSPF config
debug ip ospf Troubleshoot neighbor
adj issues
🧠 14. OSPF State Machine
1. Down
2. Init
3. 2-Way ✅ (bidirectional communication)
4. Exstart
5. Exchange
6. Loading
7. Full ✅ (LSDB fully synced)
OSPF neighbors must reach 2-Way to be neighbors
Must reach Full to exchange routing info
🎯 15. CCNA Must-Memorize Points
● OSPF = link-state, cost-based, fast convergence
● Admin Distance = 110
● RID must be unique
● Area 0 = backbone
● DR/BDR elections on multiaccess networks
● LSAs = the “gossip” that builds the LSDB
● Types 1, 2, 3, 5 = common in CCNA
● Show commands = your OSPF x-ray machine
●