🛰️ OSPF (Open Shortest Path First)
🛰️ OSPF (Open Shortest Path First)
🧠 Top 5 Key Points about OSPF
-
Link-State Protocol → OSPF shares detailed information about network topology (not just hop count).
-
Metric: Uses cost, calculated based on bandwidth (higher bandwidth = lower cost).
-
Fast Convergence: Quickly detects and adapts to network changes.
-
Supports VLSM & CIDR: Fully classless, allowing subnet flexibility.
-
Area-Based Design: Supports hierarchical networks (Area 0 = Backbone, others connect to it).
⚙️ Additional Notes
-
Works at Layer 3 (Network Layer) of the OSI model.
-
Uses Dijkstra’s SPF (Shortest Path First) algorithm.
-
Multicast addresses:
-
224.0.0.5 → All OSPF routers
-
224.0.0.6 → Designated Router (DR) and Backup DR
OSPF uses Link-State Advertisements (LSAs) to exchange topology information. Each LSA type has a specific purpose.
Here's a practical explanation of LSA Types 1–7.
1. Type 1 – Router LSA
Generated by: Every OSPF router
Flooded within: Its own area only
Purpose: Describes the router's own links and interfaces.
For example:
Area 0
R1 ----- R2 ----- R3
R1 creates a Type 1 LSA saying:
- I am Router R1
- I have a link to R2
- Cost = 10
R2 and R3 create their own Type 1 LSAs.
Think of it as:
"This is who I am and these are my neighbors."
2. Type 2 – Network LSA
Generated by: DR (Designated Router)
Flooded within: Its own area
Purpose: Lists all routers connected to a broadcast or NBMA network.
Example:
Switch
/ | \
R1 R2 R3
Suppose R2 is the DR.
R2 generates a Type 2 LSA containing:
Network
├── R1
├── R2
└── R3
Instead of every router describing the shared network, the DR does it once.
3. Type 3 – Summary LSA
Generated by: Area Border Router (ABR)
Flooded to: Other areas
Purpose: Advertises networks from one area into another.
Example:
Area 0 Area 1
R1 ---- ABR ---- R2
Area 1 has:
192.168.10.0/24
The ABR sends a Type 3 LSA into Area 0 saying:
Network:
192.168.10.0/24
Think of it as:
"Here are the networks from another area."
4. Type 4 – ASBR Summary LSA
Generated by: ABR
Purpose: Tells routers where the ASBR is.
Example:
Internet
|
ASBR
|
Area 1
|
ABR
|
Area 0
The ABR tells Area 0:
The ASBR is reachable here.
Without this, routers wouldn't know how to reach the ASBR that injected external routes.
5. Type 5 – External LSA
Generated by: Autonomous System Boundary Router (ASBR)
Flooded: Throughout the OSPF domain (except stub areas)
Purpose: Advertises routes learned from outside OSPF.
Example:
Internet
|
ASBR
The ASBR injects:
0.0.0.0/0
or
8.8.8.0/24
Every router learns these as external routes.
Think of it as:
"This network is outside OSPF."
6. Type 6 – Group Membership LSA
Purpose: Used by the multicast extension to OSPF (MOSPF).
Today it is rarely used because MOSPF has largely been replaced by other multicast routing protocols.
For most CCNA/CCNP labs, you can simply remember:
Type 6 = Multicast (MOSPF)
7. Type 7 – NSSA External LSA
Generated by: ASBR inside an NSSA (Not-So-Stubby Area)
Purpose: Advertises external routes within an NSSA.
Example:
Internet
|
ASBR
|
NSSA Area
|
ABR
|
Area 0
The ASBR creates a Type 7 LSA inside the NSSA.
When the Type 7 reaches the ABR, the ABR converts it into a Type 5 LSA before advertising it to the rest of the OSPF domain.
Summary Table
| LSA Type | Name | Generated By | Purpose |
|---|---|---|---|
| 1 | Router LSA | Every router | Describes the router and its links |
| 2 | Network LSA | DR | Describes a multi-access network and its attached routers |
| 3 | Summary LSA | ABR | Advertises networks between areas |
| 4 | ASBR Summary LSA | ABR | Advertises the location of an ASBR |
| 5 | External LSA | ASBR | Advertises routes from outside OSPF |
| 6 | Group Membership LSA | MOSPF | Supports multicast (rarely used) |
| 7 | NSSA External LSA | ASBR in NSSA | Carries external routes inside an NSSA; converted to Type 5 by the ABR |
Easy way to remember
- Type 1 → "I am this router."
- Type 2 → "These routers share this LAN."
- Type 3 → "These networks are in another area."
- Type 4 → "This is where the ASBR is."
- Type 5 → "These routes came from outside OSPF."
- Type 6 → "Multicast information (MOSPF)."
- Type 7 → "External routes inside an NSSA."
Compare OSPF route codes
| Route Code | Meaning |
|---|---|
O | Intra-area route (same OSPF area) |
O IA | Inter-area route (different OSPF area) |
O E1 | External Type 1 route |
O E2 | External Type 2 route |
O N1 | NSSA External Type 1 route |
O N2 | NSSA External Type 2 route |
🧰 OSPF Lab in Cisco Packet Tracer
🎯 Goal:
Configure OSPF routing between three routers so that all connected PCs can communicate.
🖥️ Network Topology
IP Address Plan
| Device | Interface | IP Address | Network |
|---|---|---|---|
| R1 | G0/0 | 192.168.1.1 | 192.168.1.0/24 |
| S0/0/0 | 10.0.0.1 | 10.0.0.0/30 | |
| R2 | S0/0/0 | 10.0.0.2 | 10.0.0.0/30 |
| S0/0/1 | 10.0.0.5 | 10.0.0.4/30 | |
| R3 | S0/0/1 | 10.0.0.6 | 10.0.0.4/30 |
| G0/0 | 192.168.2.1 | 192.168.2.0/24 | |
| PC1 | NIC | 192.168.1.10 | 192.168.1.0/24 |
| PC2 | NIC | 192.168.2.10 | 192.168.2.0/24 |
🪜 Step-by-Step Configuration
Step 1: Configure IP Addresses
🔹 Router R1
🔹 Router R2
🔹 Router R3
Step 2: Configure OSPF
We’ll use Process ID 1 and Area 0 (backbone area).
🔹 R1
🔹 R2
🔹 R3
Step 3: Verify OSPF Configuration
Use the following commands to verify:
➡ Shows OSPF neighbor relationships.
➡ Displays routes learned via OSPF (marked with “O”).
➡ Confirms OSPF is active on interfaces.
Step 4: Test Connectivity
-
Go to PC1 → Command Prompt
Type:
✅ If replies are successful, OSPF routing works!
🧠 What You Learned
| Concept | Description |
|---|---|
| OSPF Type | Link-State Protocol |
| Algorithm | Dijkstra’s SPF |
| Metric | Cost (based on bandwidth) |
| Area 0 | Backbone area for OSPF domains |
| Neighbor Discovery | Formed using Hello packets (224.0.0.5) |
💬 Summary
“OSPF is smarter than RIP — it builds a map of the entire network and chooses the fastest route based on cost, not just hop count.”
Comments
Post a Comment