Computer Networks Essentials / Network Protocols in Detail

OSPF (Open Shortest Path First)

๐Ÿค” What is OSPF? (Basic Idea)

In large networks:

  • Routers must quickly find the best path

  • Network changes should be reflected fast

  • Routing should be scalable and reliable

๐Ÿ“Œ OSPF is designed to solve the limitations of RIP.


๐Ÿง  Simple Definition

๐Ÿ“Œ OSPF (Open Shortest Path First) is a link-state routing protocol that finds the shortest path to a destination using cost as a metric.


๐Ÿง  Why OSPF is Needed

RIP problems โŒ:

  • Max 15 hops

  • Slow convergence

  • Not scalable

OSPF advantages โœ…:

  • Supports large networks

  • Fast convergence

  • No hop limit

  • Uses bandwidth-based cost

๐Ÿ‘‰ OSPF is used in modern enterprise networks.


๐Ÿง  Real-Life Analogy

๐Ÿ—บ๏ธ Google Maps Example

  • You see the entire road map

  • Choose the shortest & fastest route

  • Traffic updates are fast

๐Ÿ‘‰ OSPF works the same way:

  • Routers know the full network topology

  • Choose the best path


๐Ÿงญ Where Does OSPF Work?

  • OSPF is a Network Layer routing protocol

  • Uses IP protocol number 89

  • Does NOT use TCP or UDP


๐Ÿง  Type of Routing Algorithm Used

๐Ÿ“Œ OSPF uses Link-State Routing Algorithm

Protocol

Routing Type

RIP

Distance Vector

OSPF

Link State


๐Ÿงฎ Routing Metric in OSPF

๐Ÿ“Œ Cost is based on bandwidth

Formula:

Cost = Reference Bandwidth / Interface Bandwidth

๐Ÿ‘‰ Lower cost = Better path


๐Ÿง  Key OSPF Concepts

๐Ÿ“Œ LSAs contain:

  • Link information

  • Cost

  • Neighbor data

๐Ÿ‘‰ Routers exchange LSAs to build topology.

๐Ÿ“Œ LSDB:

  • Stores all LSAs

  • Same LSDB for all routers in an area

  • Represents full network map

๐Ÿ“Œ OSPF uses Dijkstraโ€™s Algorithm to calculate shortest paths.

๐Ÿ‘‰ Result is stored in the routing table.


๐Ÿงฉ OSPF Areas

OSPF uses hierarchical routing.


๐Ÿง  What is an Area?

๐Ÿ“Œ An area is a logical grouping of routers.

Purpose:

  • Reduce routing overhead

  • Improve scalability


๐ŸŸข Area 0 (Backbone Area)

๐Ÿ“Œ Mandatory area

๐Ÿ“Œ All other areas must connect to Area 0


๐Ÿ”ต Non-Backbone Areas

  • Area 1, Area 2, etc.

  • Connect to Area 0 via ABR


๐Ÿง  Types of OSPF Routers

Router Type

Description

Internal Router

Inside one area

Backbone Router

Connected to Area 0

ABR

Area Border Router

ASBR

Connects OSPF to other protocols


๐Ÿ”„ How OSPF Works (Step-by-Step)

1๏ธโƒฃ Routers send Hello packets

2๏ธโƒฃ Neighbors discovered

3๏ธโƒฃ LSAs exchanged

4๏ธโƒฃ LSDB built

5๏ธโƒฃ SPF algorithm runs

6๏ธโƒฃ Best routes added to routing table

๐Ÿ“Œ Convergence is very fast โšก


๐Ÿ“ฆ OSPF Packet Types

Packet Type

Purpose

Hello

Discover neighbors

DBD

Database Description

LSR

Link State Request

LSU

Link State Update

LSAck

Acknowledgement


๐Ÿง  OSPF Versions

๐ŸŸข OSPFv2

  • Used for IPv4

๐Ÿ”ต OSPFv3

  • Used for IPv6


โš–๏ธ OSPF vs RIP

Feature

RIP

OSPF

Routing Type

Distance Vector

Link State

Metric

Hop count

Cost

Max Hop

15

No limit

Convergence

Slow

Fast

Scalability

Low

High

Usage

Small networks

Large networks


๐Ÿง  Advantages of OSPF

  • Fast convergence โšก

  • Supports large networks ๐ŸŒ

  • No hop limitation

  • Efficient bandwidth usage

โŒ Disadvantages of OSPF

  • Complex configuration

  • More memory & CPU usage

  • Requires skilled administration


๐Ÿง  Memory Tricks

  • OSPF = Open Shortest Path First

  • Cost = Bandwidth

  • Area 0 = Backbone ๐Ÿฆด

  • LSA = Link information


โญ One-Line Summary

๐Ÿ”น OSPF is a link-state routing protocol that uses cost and Dijkstraโ€™s algorithm to find the shortest and most efficient paths in large networks.