BLang's Journal
← Back

2026-09-02

Building an OSPF framework

Three routers on a broadcast segment and two more on /30 links. Getting the network statements right, turning on MD5, and the handful of show commands that tell you whether any of it worked.

Network statement wildcard masks

The easy way is network 0.0.0.0 255.255.255.255 area 0. That matches every interface on the router and puts all of them in area 0 — fine in a lab, lazy anywhere else, because it enables OSPF on interfaces you never meant to include.

A specific wildcard narrows it to the interfaces you actually want. For an interface at 10.10.1.24, either of these enables OSPF on it:

network 10.10.1.24 0.0.0.0 area 0
network 10.10.1.0 0.0.0.31 area 0

The first matches that one address exactly. The second matches the whole 10.10.1.0/27 block it sits in.

The trap is that the statement has to match the interface's own address. If the wildcard does not cover it, OSPF is simply never enabled there — no hellos go out, no adjacency forms, and nothing tells you that is why. A neighbor that will not come up is worth checking here before anywhere else.

Narrow the wildcard on purpose, not by accident.

OSPF MD5 authentication

Authentication is per interface, and it takes two commands: one to set the key, one to turn the checking on.

interface GigabitEthernet0/1
 ip ospf message-digest-key 1 md5 MySecret
 ip ospf authentication message-digest

The checking can be switched on for a whole area under the process instead, so you are not repeating that third line on every interface:

router ospf 1
 area 0 authentication message-digest

That only turns the checking on. Every interface still needs its own message-digest-key line — the key is never inherited from the area.

Both the key ID and the key string have to match on the two ends. If either one differs the adjacency never forms, and it fails quietly: the neighbor just never appears.

Key ID and key string, matching on both ends, on every interface.

Show commands

The five I keep coming back to, roughly in the order I run them:

show ip ospf neighbor
Did the adjacency form
show ip ospf interface brief
Which interfaces OSPF is actually running on, and their area and cost
show ip protocols
The network statements as the router stored them
show ip ospf interface Gi0/1
The detail view for one interface
show ip route ospf
The routes arrived