A dynamic routing protocol lets routers tell each other which networks they can reach, so a failed path is replaced without anyone editing a table. Distance-vector protocols pass tables of distances between neighbours, and link-state protocols flood a map of the whole network so that each router computes its own paths. Use one only when the network contains a loop or changes often, run it on the router-to-router links and not on user networks, and remember that its update traffic uses bandwidth on slow radio links.

Part of Networking

Routing protocols that discover paths and adapt to failures automatically: the two families, how to introduce one, and where it goes wrong.

Routers Share What They Know So That Failures Are Routed Around

Routing Basics summarises the idea: when a link fails, dynamic routers detect it, exchange updated information and recompute routes, all automatically. It names OSPF as the standard interior protocol, where each router learns the whole topology and runs Dijkstra’s algorithm, converging typically in seconds and scaling to hundreds of routers. The carrier Internet Infrastructure suggests a routing daemon such as quagga or bird for the job.

The two families, in plain terms:

  • Distance vector — each router tells its neighbours “I can reach network X at distance d”. The neighbour adds the cost of the link to it and keeps the best offer. Simple to run, slow to settle after a failure, and prone to loops while it settles. See Distance Vector
  • Link state — each router announces its own links to every router, so all hold the same map and each computes shortest paths itself. Faster to settle, more memory and more traffic to start. See Link State

What You Need

  • A loop, or a network that will change — otherwise Static Routing is easier (Routing Protocols)
  • A routing daemon on each router, all configured to the same protocol and version
  • An address plan with a subnet for every link
  • A way to test by pulling a cable — the only real proof

Method: Introduce A Dynamic Protocol

Step 1: Get the network working with static routes first Then you know the addresses and links are right, and a failure later is the protocol’s fault, not the plan’s.

Step 2: Choose the family A few routers: distance vector is enough. Many routers or links of very different speeds: link state (Link State explains the cost metric).

Step 3: Turn the protocol on for the router-to-router links only Do not run it on the user LANs. A machine on a LAN that can speak the protocol can announce routes that are not real, which would redirect traffic (Network Security).

Step 4: Choose the cost metric to match the links Hop count treats a slow radio link and a fast cable alike. Where speeds differ, set costs so the faster path is preferred.

Step 5: Remove the static routes the protocol now covers A leftover static route overrides or conflicts with the protocol and hides failures.

Step 6: Pull a cable and watch The network should recover by itself, and you should know how long it took.

Worked Example: A Ring Of Four Settlements

Settlements A, B, C and D are joined in a ring by links A-B, B-C, C-D and D-A. With hop count as the cost:

  • A to B: 1 hop (direct).
  • A to C: 2 hops, either A-B-C or A-D-C. Both cost the same.

Cut link A-B. A dynamic protocol notices and recomputes. A to B now goes A-D-C-B: 3 hops. B to A is the reverse, B-C-D-A, also 3 hops. Every other pair remains connected. With static routes, A would keep sending traffic for B into the dead link.

The traffic that the protocol itself sends is also a cost, small on a cable and significant on a slow radio link; Link State counts the flood for a worked network.

Common Mistakes

  • Running the protocol on user networks — an untrusted machine can inject routes
  • Mixing two protocols without a reason — each router then has two opinions and the result is hard to explain
  • Trusting that it works without a test — a typing mistake in the configuration leaves the protocol silently doing nothing; pull a cable on a quiet day
  • Choosing a metric that ignores link speed — a slow link then carries traffic that a fast one could

What’s Next