OSPF is the link-state interior gateway protocol most data-centre and enterprise fabrics still run today. Compared to BGP, it converges faster, requires less policy, and computes shortest paths automatically from interface metrics — at the cost of higher CPU during topology change. FRR’s ospfd is the Linux implementation. This article walks through the area model, the LSA types you will see in show ip ospf database, a working two-router setup, and the operational habits around timer tuning and authentication.
How to verify
Inspect OSPF state via vtysh:
vtysh -c 'show ip ospf'
vtysh -c 'show ip ospf neighbor'
vtysh -c 'show ip ospf interface'
vtysh -c 'show ip ospf database'
vtysh -c 'show ip ospf border-routers'
vtysh -c 'show ip route ospf'
vtysh -c 'show ip ospf route'
show ip ospf neighbor should show state Full for every adjacency you expect. Init, 2-Way, or ExStart means the neighbour started talking but never finished syncing — usually a mismatch in subnet, area, or auth.
What’s happening
OSPF runs directly over IP (protocol 89, not TCP or UDP), exchanging Link State Advertisements (LSAs) between routers in the same area. Every router floods its local LSAs to all neighbours; once a router has heard every LSA in its area, it has a complete topology graph and runs Dijkstra to compute shortest paths.
Areas are the scaling mechanism. A small network uses a single area (Area 0, the backbone). Larger fabrics split into multiple areas, with Area Border Routers (ABRs) connecting them. LSAs flood within an area but summarise across area boundaries.
The LSA types you will see:
- Type 1 (Router LSA) — every router originates one, listing its directly-connected links and neighbours
- Type 2 (Network LSA) — designated router on a multi-access segment originates one, listing the routers on that segment
- Type 3 (Summary LSA) — ABRs originate these, advertising prefixes from one area into another
- Type 4 (ASBR Summary) — ABRs advertise the existence of an ASBR (autonomous-system boundary router) into other areas
- Type 5 (External LSA) — ASBR originates one per external prefix redistributed from BGP or static
- Type 7 (NSSA External) — like Type 5 but in a not-so-stubby area
Areas have flavours: normal (carries all LSAs), stub (drops Type 5, gets a default from the ABR), totally stubby (drops 3, 4, 5), NSSA (replaces 5 with 7).
The procedure
-
Install FRR and enable ospfd.
apt install frr sed -i 's/^ospfd=no/ospfd=yes/' /etc/frr/daemons systemctl restart frr -
Configure a two-router lab. R1 (
10.0.0.1onlo,192.168.10.1/24oneth0) and R2 (10.0.0.2,192.168.10.2/24), both in Area 0:! On R1: /etc/frr/frr.conf router ospf ospf router-id 10.0.0.1 network 192.168.10.0/24 area 0 network 10.0.0.1/32 area 0 passive-interface default no passive-interface eth0 timers throttle spf 50 200 5000 timers throttle lsa all 0 5000 5000 interface eth0 ip ospf hello-interval 5 ip ospf dead-interval 20 ip ospf cost 10Mirror on R2 with its router-id and addresses. Apply:
vtysh -c 'write memory' systemctl reload frr -
Verify adjacency forms.
vtysh -c 'show ip ospf neighbor'Expected:
Neighbor ID Pri State Dead Time Address Interface 10.0.0.2 1 Full/DR 00:00:19 192.168.10.2 eth0:192.168.10.1 -
Add a stub area for a small leaf segment. Area 1 hosts user prefixes; the ABR is R1.
! On R1 router ospf network 192.168.20.0/24 area 1 area 1 stub area 1 default-cost 10The ABR injects a default route into Area 1 and drops Type 5 LSAs.
-
Authenticate the adjacency. OSPF supports MD5 or HMAC-SHA-256 keychains:
key chain ospf-keys key 1 key-string Sup3rSecret cryptographic-algorithm hmac-sha-256 interface eth0 ip ospf authentication key-chain ospf-keysApply on both ends — a key mismatch keeps adjacency in
Initstate. -
Tune SPF/LSA throttling for fast convergence. Defaults are very conservative. For a small DC fabric:
timers throttle spf 50 200 5000 ! min 50ms, hold 200ms, max 5s timers throttle lsa all 0 5000 5000 ! initial 0, min 5s, max 5sAggressive timers reduce convergence time after a link event from several seconds to under 200ms; the cost is more CPU during flap.
-
Redistribute connected and static routes when needed.
router ospf redistribute connected route-map RM-CONN redistribute static route-map RM-STATIC route-map RM-CONN permit 10 match interface loWithout a route-map, redistribution emits every connected prefix; the map limits which ones make it in.
Operational notes
- Hello/Dead intervals must match between neighbours. Default is 10s/40s on broadcast networks. Many engagements drop these to 1s/4s for fast detect; BFD on top brings it sub-second.
- MTU on adjacency — OSPF Database Description packets are MTU-sensitive; if both ends do not agree on interface MTU, the adjacency stalls at
ExStart.ip ospf mtu-ignoreis the workaround; matching MTUs is the fix. - DR/BDR election on multi-access segments picks the highest router-id (after
priority). Newly-joined routers do not preempt unlessip ospf priorityis set higher; this can leave an old slow router as DR forever. passive-interface defaultprevents OSPF from forming adjacencies on every interface; explicitly enable only the ones you want. Forgetting this on a server with a public NIC means OSPF Hello multicasts leak to your provider.- Areas are not security boundaries. A router in Area 1 sees Type 3 summaries from Area 0; if you want a true firewall between routing domains, use BGP between independent OSPF instances.
In the engagements we run, OSPF is the default IGP inside a data centre or a multi-site enterprise. It pairs naturally with BGP for external routing (OSPF carries loopback prefixes between routers, BGP rides over those loopbacks). The lab-scale config above expands to dozens of routers with no structural changes — only the area design grows. Both protocols live in the FRR install our managed-operations practice deploys on every routing host, and the BGP article covers the next step out from the IGP.