Octet

What does the network statement actually do in OSPF, and what is the alternative?

Show the answer

Say this first

It does not advertise a network directly. It matches interface addresses with a wildcard mask and enables OSPF on every interface that matches, in the given area. That interface then sends hellos and its subnet is advertised. The alternative is ip ospf <process> area <area> on the interface, which I prefer.

Go deeper

Network statements

Cisco IOS
router ospf 1
 network 10.0.12.0 0.0.0.3 area 0
 network 10.10.0.0 0.0.255.255 area 1
 network 1.1.1.1 0.0.0.0 area 0
  • 0.0.0.3 with 10.0.12.0 matches 10.0.12.0 to 10.0.12.3.
  • 0.0.0.0 matches one exact interface address. It is the most precise form.
  • The first matching statement wins, most specific first in the running config.

Interface mode

Cisco IOS
interface GigabitEthernet0/0/0
 ip ospf 1 area 0

It is explicit, cannot match a new interface by accident, and wins over a network statement.

Common mistakes

  • network 0.0.0.0 255.255.255.255 area 0 enables OSPF on every interface, including the ones to the ISP.
  • The mask in the network statement is a wildcard, not a subnet mask.
  • The prefix advertised is the interface's real subnet, not the range in the statement.

Traps

  • Thinking network 10.0.0.0 0.255.255.255 area 0 advertises a /8. It enables matching interfaces and advertises their own subnets.
How did you do?