Sub topic 2
From Down to Full: The OSPF Neighbor State Machine
Assume you know IPv4 addressing, interface configuration, routing tables, and static versus dynamic routing.
From Down to Full
OSPF routers use Hello packets to discover neighbors and agree on basic settings. A neighbor relationship normally progresses through these states:
- Down: No valid Hello has arrived.
- Init: A Hello arrived, but it did not list this router.
- 2-Way: Both routers list each other. On broadcast networks, the DR and BDR are elected here.
- ExStart: Routers choose master and slave roles for database exchange.
- Exchange: They describe their link-state databases with Database Description packets.
- Loading: Each router requests missing or newer LSAs.
- Full: Both databases are synchronized.
An adjacency can stall when area IDs, timers, authentication, network types, or MTUs do not match. A 2-Way relationship can be normal between routers that do not need a full adjacency on a broadcast segment.
The Link-State Database and LSA Flooding
A link-state database (LSDB) is the router's map of the OSPF area. Routers describe links with link-state advertisements (LSAs). They flood new or changed LSAs through the area, acknowledge them, and age out stale information. Routers in the same area should have synchronized LSDBs.
Cost and the SPF Calculation
OSPF assigns a cost to each link. The path cost is the sum of its link costs. Each router runs the shortest path first (SPF) algorithm, based on Dijkstra's algorithm, from itself as the root.
links = {"R1-R3": 1, "R3-R2": 1, "R1-R2": 10}
print(links["R1-R3"] + links["R3-R2"]) # 2R1 chooses R1–R3–R2 with cost 2 instead of the direct cost-10 link.
> callout note > A lower OSPF cost wins within the same route category. Changing interface bandwidth or setting a manual cost can change the selected path.
Areas and Router Roles
Area 0 is the OSPF backbone. Other areas should connect to it so inter-area routes have a consistent path.
| Role | Meaning |
|---|---|
| Internal router | All interfaces belong to one area |
| ABR | Connects Area 0 to another area |
| ASBR | Injects routes from another routing source |
Reading LSA Types 1–5
- Type 1: Router LSA, created by each router for its area.
- Type 2: Network LSA, created by the DR on a broadcast segment.
- Type 3: Summary LSA, an ABR's advertisement of inter-area networks.
- Type 4: Summary ASBR LSA, a route to an ASBR.
- Type 5: External LSA, an ASBR's advertisement of routes outside OSPF.
Exercise
Which state proves that two OSPF routers have synchronized their LSDBs?
Show answer
Full.