Sub topic 18
Choosing between distance-vector and link-state
This chapter assumes you know basic IP addressing, the difference between a router and a switch, how longest-prefix match picks a route, and the graph terms node, edge, weight and shortest path. It also assumes you have seen the Bellman-Ford update, the Dijkstra computation, RIP and OSPF in earlier chapters. Here the goal is a decision: given a network, which family fits, and what goes wrong when you choose badly.
What each family actually shares
A distance-vector router knows only what its neighbors tell it: a destination and a cost. It never sees the topology behind that cost. A link-state router floods descriptions of its own links, stores every router's description in a link-state database (LSDB), and runs Dijkstra on that shared map.
That one difference drives almost every trade-off below.
| Property | Distance-vector (RIP) | Link-state (OSPF, IS-IS) |
|---|---|---|
| What is exchanged | Whole or partial table of (destination, cost) | Link descriptions (LSAs or LSPs) |
| Who receives it | Direct neighbors only | Every router in the flooding scope |
| View of the network | Next hop and cost per destination | Full graph of the area |
| Computation | Bellman-Ford update per advertisement | Dijkstra over the LSDB |
| Loop risk during change | Real, needs extra mechanisms | Brief, from unsynchronized databases |
| Typical metric | Hop count (RIP) | Configurable cost, often bandwidth based |
| Memory and CPU | Low | Higher, grows with LSDB size |
| Configuration | Very little | Router IDs, areas, authentication, timers |
Convergence
Convergence is the time until every router's table is consistent with the real topology. Compare the two on a link failure.
- Distance-vector: the news spreads one neighbor exchange at a time. RIP sends updates every 30 seconds by default, and a route is only declared dead after a timeout (180 seconds by default). Triggered updates and poison reverse help, but a chain of routers still learns the bad news hop by hop.
- Link-state: the router next to the failure floods a new LSA right away. Every router receives it within roughly the sum of link delays, then runs Dijkstra independently. Convergence is typically sub-second to a few seconds. Failure detection (hello dead interval, or faster mechanisms such as BFD) often dominates the total time.
Scalability limits
Distance-vector limits come from the protocol itself. RIP treats 16 as infinity, so the network diameter is at most 15 hops. Every router also advertises its whole table periodically, which wastes bandwidth as the table grows.
Link-state limits come from cost of state. Each router stores the whole LSDB and reruns Dijkstra whenever it changes. A flapping link in a large flat area makes every router recompute repeatedly. OSPF answers with areas: routers hold full detail only for their own area, and the backbone (area 0) carries summaries between areas. IS-IS uses a similar split with Level 1 and Level 2.
# Rough cost of one SPF run: heap-based Dijkstra is O(E log V).
import math
def spf_work(routers, links):
return links * math.log2(routers)
for n, e in [(50, 150), (500, 1500), (5000, 15000)]:
print(n, "routers:", round(spf_work(n, e)), "operations per SPF run")The numbers stay small for modern hardware. The real concern is how often the run happens, which is why routers apply SPF throttling timers.
Failure modes to expect
- Distance-vector: count to infinity and transient loops after a failure. Split horizon, poison reverse, hold-down and a low maximum metric reduce this but slow convergence or limit network size.
- Link-state: inconsistent LSDBs during flooding can cause short micro-loops. A mismatched hello timer, MTU or area ID prevents an adjacency, so the network looks healthy but routers never exchange LSAs.
- Both: a metric that does not reflect link quality. RIP picks a one-hop 56 kbit/s link over a two-hop gigabit path because hops are all it counts.
Operational considerations
Configuration shows the difference in effort. RIP needs a version and the networks to enable:
router rip
version 2
network 10.0.0.0
no auto-summaryOSPF needs a router ID and an area for every enabled interface:
router ospf 1
router-id 1.1.1.1
network 10.0.0.0 0.0.0.255 area 0Both are short, but OSPF needs more planning. You must design areas, pick costs, and decide which routers become area border routers. Troubleshooting is also easier with link-state, because every router holds the same map and you can compare databases. With distance-vector you often trace advertisements router by router.
Decision criteria
Ask these questions in order.
- How large is the network? A few routers, or a diameter under 15 hops, makes RIP possible. Dozens of routers or more point to link-state.
- Do links differ in speed? If yes, you need a configurable metric, which means link-state (or EIGRP).
- How fast must it recover? Seconds or less requires link-state plus fast failure detection. Minutes may be acceptable for a small lab or a stub site.
- What can the devices and staff support? Very small or simple devices may only run RIP. A team that cannot maintain an area design may prefer a flat single-area OSPF.
- Do you need traffic engineering or very large scale? IS-IS is common in service provider backbones, and OSPF in enterprises. Between organizations, neither applies. That is the job of path-vector routing with BGP.
In practice, most modern internal networks use OSPF or IS-IS. RIP survives in small, simple or legacy environments, and EIGRP appears in Cisco-centered networks as an advanced distance-vector design.
Exercise
A company has 40 routers, links ranging from 100 Mbit/s to 10 Gbit/s, and requires recovery from a link failure in under five seconds. Which family fits, and give two reasons RIP is unsuitable?
Show answer
Link-state (OSPF or IS-IS). RIP counts hops, so it cannot prefer fast links over slow ones, and its 30-second updates and 180-second route timeout make recovery far slower than five seconds. Its 15-hop limit could also become a constraint as the network grows.
Exercise
An OSPF network is stable except for one flapping link in a large single area, and router CPU load spikes. Name the cause and two mitigations.
Show answer
Every LSA change makes every router in the area rerun SPF. Mitigations include splitting the network into areas so the flap is contained, summarizing routes at area borders, applying SPF and LSA throttling timers, and fixing or dampening the unstable link.