Open Shortest Path First version 2 (OSPFv2)

How OSPFv2 builds an IPv4 topology inside each area and calculates routes from link costs.

Hellos, adjacencies and the link-state database

OSPFv2 runs over IPv4 using IP protocol 89. Routers use Hello packets to discover neighbors and check parameters such as area ID and timers. Routers that form a full adjacency synchronize the relevant link-state information and flood later changes.

On a broadcast network, the designated router and backup designated router become fully adjacent with the other participating routers. Two routers with neither role can remain in 2-Way state with each other while the network is healthy.

Areas, LSAs and path cost

An area has its own topology database. A Type 1 router LSA describes a router’s links in the area. On a transit broadcast network, the designated router originates a Type 2 network LSA describing the routers attached to the segment. Each router runs shortest path first (SPF) to find paths based on the sum of their link costs.

Area 0 is the backbone for traffic between areas. An area border router (ABR) advertises inter-area reachability with Type 3 summary LSAs. Routers in another area can learn a prefix and its cost without receiving all the LSAs describing that prefix’s local topology.

Try it in a lab

  1. Connect two OSPFv2 routers over a point-to-point transit link in area 0. Advertise a loopback from one router. Verify that the neighbor reaches Full and that the other router learns the loopback as an intra-area route.
  2. Change the transit area on only one end. Confirm that the connected IPv4 interfaces can still reach each other, while the OSPF adjacency drops and the learned route is removed.
  3. Restore the matching area and verify that the adjacency and route return.

Sources