NightFox

NightFox

OSPF Routing


OSPF is usually the first "real" routing protocol people learn, and it's the one I reach for when a network has enough routers that keeping static routes straight is getting fragile. Every router tells the others about its links, they all build the same map of the network, and each one works out its own shortest path by cost. When it works, it's great. When an adjacency won't come up, it's almost always one of a short list of mismatches.

When it's worth it

If you've got a few routers and more than one path between things, OSPF starts paying for itself. You'll see it in campus networks, enterprise WANs, infrastructure networks, and inside provider networks. If you've got one router and a default route, you don't need it.

The vocabulary

  • Router ID: a 32-bit ID that looks like an IPv4 address. It doesn't have to be reachable, but I like setting it to a loopback address so it's easy to recognize.
  • Area: a group of routers that share detailed topology. Limits how far changes spread.
  • Area 0: the backbone. Other areas connect to it.
  • Adjacency: the relationship two routers form once they agree on everything.
  • Link-state database: the map everybody shares.
  • Cost: OSPF's metric. Lower is better.

When neighbors won't come up

This is the checklist I go through. Two routers won't become full neighbors unless all of this agrees:

  • Same IP subnet on the connecting interfaces.
  • Same area ID.
  • Same hello and dead timers.
  • Same authentication settings.
  • Compatible network types (broadcast vs. point-to-point bites people).
  • Matching MTU, or at least not mismatched enough to break the database exchange.
  • Nothing filtering OSPF packets (protocol 89).

Areas

Areas cut down how much topology every router has to carry around. Honestly, a small network can put everything in area 0 and be perfectly happy. Bigger networks use more areas to keep failures contained and cut down on recalculation.

Area typeWhat it does
BackboneArea 0. Ties everything together.
NormalTakes everything: intra-area, inter-area, and external routes.
StubKeeps external routes out; usually relies on a default route.
Totally stubbyCisco extension that also drops inter-area summaries. Just a default.
NSSAStub-like, but lets you inject some external routes locally.

Cisco IOS config

interface Loopback0
 ip address 10.255.0.1 255.255.255.255
!
interface GigabitEthernet0/0
 ip address 10.0.12.1 255.255.255.252
 ip ospf 10 area 0
!
router ospf 10
 router-id 10.255.0.1
 passive-interface default
 no passive-interface GigabitEthernet0/0

Two habits I like here. First, configuring OSPF on the interface instead of with network statements makes it obvious which interfaces are participating. Second, passive-interface default means user-facing networks still get advertised, but nobody can plug something into an access port and start an OSPF adjacency with your core.

VyOS config

configure
set protocols ospf parameters router-id 10.255.0.2
set protocols ospf area 0 network 10.0.12.0/30
set protocols ospf area 0 network 10.20.0.0/16
set protocols ospf passive-interface 10.20.0.1
commit
save

Cost

Each interface has a cost, and the path with the lowest total wins. If several paths tie, OSPF installs all of them and traffic gets spread across them.

Watch out for the default cost calculation. It's based on a reference bandwidth that made sense decades ago, so 1 Gb, 10 Gb, and 100 Gb links can all end up with the same cost of 1. Raise the reference bandwidth (on every router, consistently) or set costs by hand.

Summarization

Summarizing routes keeps tables small and stops every little change from rippling across the whole network. But it only works if your address plan was built for it. If subnets got handed out randomly over the years, clean summaries are somewhere between hard and impossible.

Lesson: routing that scales starts with address planning. Set aside contiguous blocks for sites, racks, tenants, or functions before you need them.

Commands I check with

show ip ospf neighbor
show ip ospf interface brief
show ip ospf database
show ip route ospf
show ip protocols

show protocols ospf neighbor
show protocols ospf database
show ip route ospf

The first block is Cisco, the second is VyOS.

Common problems and where I look

  • Stuck in EXSTART or EXCHANGE: it's almost always MTU.
  • No neighbor at all: layer 2 connectivity, addressing, area, timers, passive interfaces, filters.
  • A route is missing: is the network actually included, is the interface up, is filtering or the area type hiding it?
  • Traffic takes a weird path: compare costs along each path, and make sure things have actually converged.
  • Adjacencies keep flapping: packet loss, interface errors, CPU, a duplicate router ID, or a link that's just unhealthy.

Last Modified: October 12, 2026, 11:41 am