Post

Revise OSPF

Revise OSPF

OSPF (Open Shortest Path First) β€” Complete Beginner to Advanced Notes


πŸ”° 1. Absolute Basics: What is OSPF?

🧠 Simple Explanation

OSPF is a routing protocol used by routers to find the best path for data.

πŸ‘‰ Think of it like Google Maps for a network:

  • It doesn’t just follow directions blindly
  • It builds a full map of the network and decides the best route itself

πŸ“Œ Example

Router A β†’ wants to send data to Router C

Instead of asking:

β€œHey B, how do I reach C?”

It already knows:

  • All paths
  • Link speeds

So it calculates the fastest route itself


🎯 Why It’s Important

  • Open standard (works on Cisco, Juniper, MikroTik, etc.)
  • Fast convergence (quickly adapts to failures)
  • Loop-free routing
  • Scalable for large networks

πŸ”— Connect to Next Concept

Before routers build a map, they need identity

➑️ Next: Router ID (RID)


πŸ” Quick Revision

  • OSPF = Link-State Protocol
  • Builds full network map (LSDB)
  • Chooses best path using logic (not guess)

πŸ†” 2. Router Identity: Router ID (RID)

🧠 Simple Explanation

Every router needs a unique name

πŸ‘‰ That name is called Router ID (RID)

Format: Looks like an IP
Example: 1.1.1.1


βš™οΈ How RID is Selected (Priority Order)

  1. Manual β†’ router-id 1.1.1.1
  2. Highest Loopback IP
  3. Highest Physical Interface IP

πŸ“Œ Example

  • Loopback0 β†’ 10.10.10.10
  • Interface β†’ 192.168.1.1

πŸ‘‰ RID = 10.10.10.10 (Loopback wins)


🎯 Why It’s Important

  • Identifies routers uniquely
  • Used in LSAs and topology
  • Prevents confusion in network

🧠 Memory Trick

πŸ‘‰ RID = Aadhaar Card of Router

  • Unique
  • Fixed (until restart)

⚠️ Common Mistake

  • Changing RID without restarting OSPF β†’ No effect

πŸ”— Connect to Next Concept

Now router has identity
➑️ Next: How routers discover neighbors


πŸ” Quick Revision

  • RID = Unique router identity
  • Must be unique
  • Selected in priority order

🀝 3. Neighbors & Adjacency

⚠️ Before Understanding This

You must know: πŸ‘‰ Routers don’t share data with everyone β€” only trusted neighbors


🧠 Simple Explanation

Step 1: Discover

Routers send Hello packets
πŸ“‘ Multicast: 224.0.0.5

Step 2: Become Neighbors

If rules match β†’ become Neighbors

Step 3: Become Adjacent

If fully synced β†’ become Full (Adjacency)


πŸ“Œ Example

Router A & B:

  • Same subnet βœ”οΈ
  • Same area βœ”οΈ
  • Same timers βœ”οΈ

πŸ‘‰ Result: FULL adjacency


πŸ“‹ Adjacency Requirements

RequirementMust Match
Area IDYes
SubnetYes
Hello TimerYes
Dead TimerYes
RIDMust be unique

🎯 Why It’s Important

  • Only adjacent routers share full topology
  • Prevents incorrect routing

⚠️ Common Mistakes

  • MTU mismatch β†’ stuck in EXSTART
  • Timer mismatch β†’ no neighbor
  • Same RID β†’ OSPF failure

πŸ”— Connect to Next Concept

Too many routers = too much communication

➑️ Solution: DR & BDR


πŸ” Quick Revision

  • Hello β†’ Neighbor β†’ Adjacency
  • FULL state = synchronized LSDB
  • Matching parameters is critical

πŸ‘‘ 4. DR & BDR (Designated Router)

⚠️ Before Understanding This

In large networks: πŸ‘‰ Every router talking to every router = chaos


🧠 Simple Explanation

OSPF elects:

  • DR (Leader)
  • BDR (Backup Leader)

🎭 Analogy

Classroom:

  • Students = Routers
  • Class Monitor = DR
  • Assistant Monitor = BDR

Instead of everyone talking: πŸ‘‰ All talk to DR


βš™οΈ Election Process

  1. Highest Priority (default = 1)
  2. Highest RID (tie-breaker)

πŸ‘‰ Priority 0 = Never DR


πŸ“Œ Example

| Router | Priority | RID | |——–|——–|—–| | R1 | 1 | 1.1.1.1 | | R2 | 1 | 2.2.2.2 |

πŸ‘‰ DR = R2 (higher RID)


🎯 Why It’s Important

  • Reduces traffic
  • Saves CPU/memory
  • Efficient communication

⚠️ Common Mistake

  • DR election is non-preemptive πŸ‘‰ New better router won’t replace DR

πŸ”— Connect to Next Concept

We optimized one network segment
But what about 1000 routers?

➑️ Next: Areas


πŸ” Quick Revision

  • DR = Leader
  • BDR = Backup
  • Reduces communication

🌍 5. OSPF Areas

🧠 Simple Explanation

OSPF divides network into Areas

πŸ‘‰ Like dividing a city into zones


πŸ™οΈ Types of Areas

πŸ”΅ Area 0 (Backbone)

  • Core of OSPF
  • All areas must connect here

🟒 Other Areas

  • Branch networks

πŸ‘₯ Router Types

RouterRole
InternalInside one area
ABRConnects Area 0 + other areas
ASBRConnects external network

πŸ“Œ Example

  • Area 1 β†’ Branch office
  • Area 0 β†’ HQ
  • ABR connects both

🎯 Why It’s Important

  • Reduces LSDB size
  • Improves scalability
  • Faster performance

⚠️ Common Mistake

  • Area not connected to Area 0 β†’ OSPF fails

πŸ”— Connect to Next Concept

Now routers have map
➑️ How do they choose best path?

Next: Cost (Metric)


πŸ” Quick Revision

  • Area 0 = Backbone
  • ABR connects areas
  • Areas = scalability

πŸ’° 6. Cost (Metric)

🧠 Simple Explanation

OSPF uses Cost to choose best path

πŸ‘‰ Lower cost = Better path


βš™οΈ Formula

::contentReference[oaicite:0]{index=0}


πŸ“Œ Example

BandwidthCost
10 Mbps10
100 Mbps1

🎯 Why It’s Important

  • Determines routing path
  • Based on speed (not hops)

⚠️ Common Mistake

Default Reference Bandwidth = 100 Mbps

πŸ‘‰ So:

  • 100 Mbps = cost 1
  • 10 Gbps = cost 1 ❌ (wrong)

βœ”οΈ Fix: Manually increase reference bandwidth


πŸ”— Connect to Next Concept

Routers share topology using messages

➑️ Next: LSAs


πŸ” Quick Revision

  • Cost = based on bandwidth
  • Lower = better
  • Must tune reference bandwidth

πŸ“© 7. LSAs (Link-State Advertisements)

⚠️ Before Understanding This

LSA = Information packet about network


🧠 Simple Explanation

Routers send LSAs like: πŸ‘‰ β€œHere’s my network info”


πŸ“¦ Types of LSAs

🟒 Type 1 (Router LSA)

  • Created by every router
  • Contains its links

πŸ”΅ Type 2 (Network LSA)

  • Created by DR
  • Lists routers in network

🟑 Type 3 (Summary LSA)

  • Created by ABR
  • Shares between areas

πŸ”΄ Type 5 (External LSA)

  • Created by ASBR
  • External routes (Internet)

🎯 Why It’s Important

  • Builds LSDB (network map)
  • Keeps routers updated

πŸ”— Connect to Next Concept

Now let’s configure OSPF

➑️ Next: Configuration


πŸ” Quick Revision

  • LSA = network info packet
  • Type 1 = router
  • Type 3 = inter-area
  • Type 5 = external

βš™οΈ 8. Basic Configuration (OSPFv2)

🧠 Steps

Step 1: Start OSPF

1
router ospf 1

Step 2: Set RID

1
router-id 1.1.1.1

Step 3: Add Networks

Method 1:

1
network 10.0.0.1 0.0.0.0 area 0

Method 2:

1
2
interface g0/0
ip ospf 1 area 0

Step 4: Passive Interface

1
passive-interface g0/1

πŸ‘‰ Used for LAN (no OSPF hellos sent)


🎯 Why It’s Important

  • Enables routing
  • Controls OSPF behavior

⚠️ Common Mistake

  • Forgetting wildcard mask
  • Wrong area assignment

πŸ” Quick Revision

  • router ospf β†’ start
  • network β†’ enable interfaces
  • passive β†’ optimize

🌐 9. OSPFv3 (IPv6)

🧠 Simple Explanation

OSPFv3 = OSPF for IPv6


πŸ”‘ Key Differences

FeatureOSPFv2OSPFv3
AddressIPv4IPv6
RIDAutoManual required
DiscoveryNormal IPLink-local (FE80::)

🎯 Why It’s Important

  • Required for IPv6 networks
  • Same logic, new structure

πŸ” Quick Revision

  • OSPFv3 = IPv6 version
  • Manual RID required
  • Uses link-local

🧠 10. BIG PICTURE (Final Understanding)

πŸ”„ Full Workflow

  1. Router gets RID
  2. Sends Hello packets
  3. Forms Neighbors
  4. Becomes Adjacent (FULL)
  5. Elects DR/BDR
  6. Exchanges LSAs
  7. Builds LSDB (Map)
  8. Calculates path using Cost + SPF
  9. Routes traffic

🎯 Final Analogy

πŸ‘‰ OSPF = Google Maps System

OSPF ConceptReal Life
RIDPhone number
LSDBMap
LSAUpdates
CostTravel time
SPFRoute calculation

⚠️ Common Mistakes (VERY IMPORTANT)

  • Same Router ID ❌
  • Area mismatch ❌
  • Timer mismatch ❌
  • MTU mismatch ❌
  • Not connecting to Area 0 ❌
  • Not updating reference bandwidth ❌

🧠 Memory Tricks

  • RID = Aadhaar Card
  • DR = Class Monitor
  • LSA = WhatsApp Updates
  • Cost = Travel Time
  • Area 0 = Main Highway

βœ… FINAL REVISION SUMMARY

  • OSPF = Link-State Protocol
  • Builds full network map (LSDB)
  • Uses RID for identity
  • Uses Hello packets for neighbors
  • DR/BDR reduces traffic
  • Areas improve scalability
  • Cost decides best path
  • LSAs share information
  • OSPFv3 = IPv6 version

πŸš€ You Are Now OSPF Ready

If you want next level: πŸ‘‰ I can help you with:

  • OSPF packet flow deep dive
  • LSA flooding lab
  • DR election packet capture (Wireshark)
  • Interview questions (real-world)

Just tell me πŸ‘

πŸ™Œ Connect With Me

GitHub LinkedIn YouTube Gmail

This post is licensed under CC BY 4.0 by the author.