OSPF — Interior Routing Explained

OSPF (Open Shortest Path First) is the most widely used Interior Gateway Protocol. It’s link-state — every router in the network builds a complete map and computes the shortest path to every destination. Fast convergence, scalable to thousands of routers, vendor-neutral.

How link-state differs from distance-vector

In distance-vector protocols (RIP, BGP), routers tell their neighbors “I can reach X with distance Y.” Routers don’t see the topology, just the summarized info.

In link-state protocols (OSPF, IS-IS), routers flood detailed link information (“I have a connection to router B with cost 10”) to ALL routers. Every router has the full topology and computes paths independently using Dijkstra’s algorithm.

The 5 OSPF packet types

Type Purpose
Hello Discover neighbors, maintain adjacencies
DBD (Database Description) Summarize what each router knows
LSR (Link-State Request) Ask for missing details
LSU (Link-State Update) Send the actual link info
LSAck Acknowledge received updates

The OSPF “areas” concept

Flooding link-state info to thousands of routers would be wasteful. OSPF divides the network into areas:

  • Area 0 (backbone) — required, central area. All other areas connect to it.
  • Other areas — connect to area 0 via Area Border Routers (ABRs).

Within an area, routers see full detail. Between areas, only summarized info crosses the border. This dramatically reduces flooding scope and SPF computation cost.

      Area 1                  Area 0                    Area 2
   (Engineering)            (Backbone)                  (Sales)
       │                         │                         │
       └──── ABR ─────────────── R0 ─────────────── ABR ────┘
       │                         │                         │
   detailed                  detailed                  detailed
   topology                  topology                  topology
                             (sees both areas summaries)

The Shortest Path First (Dijkstra)

Once each router has the topology, it runs Dijkstra to find the shortest path to every other router. “Shortest” means lowest total cost — link costs are configurable (often based on link bandwidth: 10 Gbps link = lower cost than 100 Mbps link).

Convergence

When something changes (link down, new neighbor), OSPF reacts in seconds:

  1. Router detects change (via Hello timeout, typically 40 seconds default but tunable)
  2. Originates a new LSA
  3. Floods to all neighbors
  4. Each receiving router re-runs Dijkstra (typically <1 second)
  5. New routes installed in forwarding table

BFD (Bidirectional Forwarding Detection) can drop link-failure detection from seconds to milliseconds.

OSPFv2 vs OSPFv3

  • OSPFv2 — IPv4 only. The classic.
  • OSPFv3 — supports IPv6 and IPv4. Largely the same protocol, different packet formats.

Sample config (Cisco IOS)

router ospf 1
 router-id 1.1.1.1
 network 10.1.1.0 0.0.0.255 area 0
 network 10.2.1.0 0.0.0.255 area 1

! show OSPF status
show ip ospf neighbor
show ip ospf database
show ip route ospf

Sample config (FRRouting on Linux)

router ospf
 ospf router-id 10.0.0.1
 network 10.0.0.0/24 area 0
 network 192.168.1.0/24 area 1

vtysh -c "show ip ospf neighbor"
vtysh -c "show ip route ospf"

OSPF vs IS-IS

Both link-state, both work well. Differences:

  • OSPF is more common in enterprise; IS-IS dominates large ISPs and backbones
  • IS-IS is more vendor-neutral and simpler protocol
  • OSPF has more granular tuning options
  • IS-IS is more efficient at large scale

Common gotchas

  • Mismatched Hello/Dead intervals — neighbors won’t form adjacency. Both must agree.
  • Area mismatches — same network configured in different areas on different routers won’t peer.
  • MTU mismatches — larger LSAs get fragmented or dropped, adjacency stuck in EXSTART.
  • Split-area design — non-contiguous areas need virtual links (avoid).

What to learn next

That covers routing fundamentals. Next big section: network devices — hubs, switches, routers, firewalls, load balancers — what each one does. Up next on the roadmap.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *