Articles

Dynamic routing and OSPF fundamentals: how routers learn paths from each other

A static route never notices a failure; a routing protocol lets routers repair the path.

Reading: 5 minNetworking

Article cover: Dynamic routing and OSPF fundamentals: how routers learn paths from each other

A static route is an instruction the router never revisits: when a link fails elsewhere, nothing recalculates it, and the entry stays until someone edits it. Dynamic routing closes that gap — routers find each other, describe the topology they see, and each builds a forwarding table from the shared description. OSPF (Open Shortest Path First) is the link-state interior gateway protocol enterprise networks run for this: RFC 2328 for IPv4, RFC 5340 for IPv6, which keeps the mechanisms “unchanged” but runs “on a per-link basis” (rfc5340.txt lines 31–45). How does a router that has never seen a destination learn a path to it?

Why a dynamic protocol exists

Static routing is the L2 sheet’s subject here: the administrator writes the prefix and the next hop, and the entry lives until it is changed — correct only while the topology stops changing. A protocol replaces it with a process. RFC 2328 defines OSPF as “a dynamic routing protocol” that “quickly detects topological changes in the AS (such as router interface failures) and calculates new loop-free routes after a period of convergence” (lines 280–283). The cost is recurring protocol traffic; the return is a repair nobody makes by hand.

Two families, one difference

Protocols divide into two families by what each router knows. A distance-vector protocol of the Bellman-Ford family — RIP is the classic example — exchanges a view of the table, measured in hops (Cisco OSPF Design Guide, line 100). A link-state protocol inverts that: each router describes its own links, and every router builds the map itself. RFC 2328 marks the break — “This is a departure from the Bellman-Ford base used by traditional TCP/IP internet routing protocols” (lines 262–263). “Each participating router has an identical database” (lines 289–290) — the property this sheet rests on.

How OSPF builds one shared map

Every router runs this cycle alone. Two routers on a common link become neighbours once each sees itself in the other’s Hello packet (lines 2581–2583). The pair then forms an adjacency, the conversation that synchronises their databases (Design Guide, lines 452–453). Changes travel by flooding, not as a copy of the table: “LSAs are flooded throughout the area. The flooding algorithm is reliable, ensuring that all routers in an area have exactly the same link-state database” (lines 1989–1991). Each router then decides alone, “Using the Dijkstra algorithm” (lines 8034–8035) to build “a shortest-path tree, with itself as root” (lines 1992–1994).

 discovery             adjacency              shared map           decision
 ─────────             ─────────              ──────────           ────────
 Hello packets   ─▶    database exchange  ─▶  identical LSAs   ─▶  SPF (Dijkstra)
 on each               (ExStart → Full)       for the area         self as the root
 interface                                                                   │
      ▲                                                                      │
      └──────────  a change is flooded, and every router recalculates  ◀─────┘

Neighbours must agree before anything is exchanged

A Hello packet states the link’s configuration, and the receiver checks it: “the values of the Network Mask, HelloInterval, and RouterDeadInterval fields in the received Hello packet must be checked against the values configured for the receiving interface” — any mismatch drops the packet (lines 4784–4788). “Both HelloInterval and RouterDeadInterval must be the same for all routers attached to a common network” (lines 3860–3862), and Cisco names the commands that break it: “ip ospf hello-interval seconds and ip ospf dead-interval seconds” (Design Guide, lines 411–414). The dead interval is also the detection time — “The number of seconds before the router’s neighbors will declare it down, when they stop hearing the router’s Hello Packets” (lines 3211–3212) — so this timer sets how long a broken link takes to be noticed.

Cost: what “shortest” means

An interface cost decides what “shortest” means: a path costs the sum of its links (lines 8081–8083). OSPF keeps that number dimensionless — “The cost of a route is described by a single dimensionless metric” (lines 312–313) — so the designer decides what a link is worth. By default the value comes from the bandwidth: “By default, the cost of an interface is calculated based on the bandwidth” (Design Guide, lines 178–179), written as “cost= 10000 0000/bandwith in bps” (line 175), and ip ospf cost <value> overrides it (lines 178–179).

Areas and the backbone

An area groups networks and their routers: “Each area runs a separate copy of the basic link-state routing algorithm” (lines 1273–1274), over its own database, so that “Areas are introduced to put a boundary on the explosion of link-state updates” and “Flooding and calculation of the Dijkstra algorithm on a router is limited to changes within an area” (Design Guide, lines 199–201). One area is reserved — “The OSPF backbone is the special OSPF Area 0” (line 1312) — carried by routers “that belong to multiple areas, and connect these areas to the backbone area are called area border routers (ABR)” (Design Guide, lines 201–202).

What convergence does and does not fix

Convergence is work, not a switch: detection waits for the dead interval, the change is flooded, every router recalculates its tree, while the network forwards on two different maps. The protocol never judges whether a path is good, only which is cheapest under the costs it was given, so a mis-set cost converges to a stable, wrong answer. The static part of the network does not become dynamic either.

Level and prerequisites

L3 — current routing practice, read after the L1 forwarding model and the L2 sheets on the routing table, static routes and inter-VLAN routing. It assumes the reader can read a prefix and a next hop and knows a router forwards one hop at a time; no prior routing protocol is assumed.

Where to go next

References

Nodrius Field Kit — cover

Get the Nodrius Field Kit

Enter your email and we'll send you the complete Field Kit: eight technical resources in one download.

Your email address is sent to Nodrius and used to deliver the Field Kit to you by email. Marketing messages are separate and optional: the checkbox does not affect your download, and you are only added to our updates list if you tick it. Privacy Policy.

Privacy & cookies

This site does not use cookies, analytics or tracking, and it does not profile you. There is nothing technical to switch off, so Accept and Reject change nothing about how the site works: either choice lets you browse everything normally.

The only difference is what your browser remembers: two entries in local storage — your choice here, so this notice is not shown again, and a marker that the Field Kit offer has already been made — so the offer is presented once and not on every page. They contain no identifier, they are not shared with anyone, and the site sets no cookie for either.

What we do with your data
How your email address is used when you ask for a Resource, how long it is kept and which rights you have — in the Privacy Policy.
What the site stores in your browser
Two entries in local storage — your choice on this notice and whether the Field Kit offer has been shown — and no cookies, no session storage, no third-party content: in the Cookie Policy.