Sub topic 6
Convergence: how networks react to failures
This chapter assumes you know IPv4 addressing and CIDR prefixes, the difference between a router, a switch and a host, and basic command-line use on a router or Linux host. It also assumes you have read the earlier chapters on the routing table, longest-prefix match, static routes and dynamic routing.
What convergence means
A network has converged when every router has a routing table that matches the current topology, so that all routers agree on a loop-free path to each destination. Convergence time is how long that takes after something changes, such as a link going down, a router rebooting, or a new subnet appearing.
Until the network converges, some routers still hold stale information. Their tables may point at a dead link or at a neighbor that no longer has a path. Packets sent along those routes are dropped, or they loop between routers until the IP time-to-live (TTL) field reaches zero.
Convergence is the main operational difference between static and dynamic routing:
- A static route never reacts to a failure on its own. The router keeps using it as long as its own outgoing interface is up.
- A dynamic protocol detects the failure, tells other routers, and recomputes paths. This takes time, but no human has to act.
Where convergence time goes
Convergence time is the sum of several stages. Each stage can be tuned separately.
- Detection. The router has to notice that something failed.
- Propagation. The router has to tell the other routers.
- Computation. Each router has to recalculate its best paths.
- Installation. The new routes have to be written into the routing table and the forwarding hardware.
Detection
There are two ways to detect a failure.
- Physical signals. If a cable is unplugged or the remote port goes down, the interface changes to down within milliseconds. The router withdraws every route that uses that interface right away.
- Protocol timers. If the failure happens somewhere the router cannot see, such as a failed switch between two routers or a link that still has carrier but drops traffic, the router only notices when it stops hearing from its neighbor.
Protocols send periodic keepalive messages, usually called hellos. If no hello arrives within a hold time (OSPF calls it the dead interval), the neighbor is declared down. With default OSPF timers on broadcast links, hellos are sent every 10 seconds and the dead interval is 40 seconds. That means a silent failure can take 40 seconds to detect, before any recomputation starts.
Bidirectional Forwarding Detection (BFD) is a lightweight protocol that exchanges very small packets at short intervals, often tens or hundreds of milliseconds. A routing protocol can subscribe to BFD and drop a neighbor as soon as BFD reports a failure. This brings detection time from tens of seconds to under a second.
Propagation and computation
How the news spreads depends on the protocol family, covered in later chapters:
- Link-state protocols such as OSPF flood the changed link information to every router in the area. Each router then runs the shortest-path-first calculation on its own copy of the topology. Computation is fast on modern hardware, and OSPF adds small delays (SPF throttle timers) so that a flapping link does not trigger constant recalculation.
- Distance-vector protocols such as RIP pass their whole view of the network from neighbor to neighbor. A change moves one hop per update interval, so a large network can take minutes to settle.
Installation
Once a new best route is chosen, the router writes it to its routing table and then to the forwarding table used by the line cards or the kernel. This is usually fast, but with very large tables, such as a full internet BGP table, installation can add noticeable time.
Static routes during a failure
Consider a router R1 with this static route toward a remote network through R2:
sudo ip route add 10.2.0.0/16 via 192.168.1.2 dev eth0If the cable between R1 and R2 is unplugged, eth0 goes down and Linux removes the route. R1 then has no path to 10.2.0.0/16, unless another route covers it, such as a default route.
Now suppose R2 itself crashes, but eth0 on R1 stays up because a switch sits between them. R1's interface still has carrier, so the static route stays in the table. R1 keeps sending traffic to a next hop that does not answer. This is a black hole, which means traffic disappears without any error being reported to the sender.
A static route is withdrawn only when its local interface goes down. It is not withdrawn when the next hop becomes unreachable beyond that interface. Two common fixes:
- Use a dynamic protocol, which uses hellos to find out that the neighbor is gone.
- Track the route with a probe. On Cisco IOS, an IP SLA operation can ping the next hop, and the static route is installed only while the probe succeeds. A floating static route (covered in a later chapter) then takes over as backup.
Dynamic routing during a failure
Take a small OSPF network with two paths from R1 to the 10.2.0.0/16 network: a primary path through R2 and a backup through R3.
- The R1-R2 link fails.
- R1 detects the failure, either through interface down or through the dead interval.
- R1 floods an updated link-state advertisement. R2 and R3 do the same for what they see.
- Every router in the area runs SPF and finds that the best path to
10.2.0.0/16now goes through R3. - R1 installs the new route and removes the old one.
No administrator input is needed. The time between step 1 and step 5 is the convergence time. Traffic sent in that window is lost, unless the router has a precomputed backup path (see fast reroute below).
You can check what the router now believes with the commands from the topic's verification examples:
! Cisco IOS
show ip route 10.2.5.7
show ip route ospf
show ip ospf neighborshow ip ospf neighbor is useful during a failure, because a neighbor that has dropped out of the list explains why the routes changed.
Problems during convergence
Convergence is not instant, so networks pass through transitional states.
Black holes
A black hole is a router that still has a route to a destination but cannot deliver the packets. It happens when detection is slow, or when one router has already updated and its neighbor has not.
Routing loops
During the transition, router A may think the best path to a network is through B, while B thinks the best path is through A. A packet then bounces between them until its TTL expires. Distance-vector protocols are especially prone to this, because each router relies on its neighbors' summaries and cannot verify them. The classic case is the count-to-infinity problem. After a network becomes unreachable, routers keep advertising it to each other with a growing hop count. Protocols limit the damage with these techniques:
- Maximum metric. RIP treats 16 hops as unreachable, which caps how long the count can go on.
- Split horizon. A router does not advertise a route back out the interface it learned it from.
- Route poisoning. A router advertises a failed route with the unreachable metric so that neighbors drop it quickly.
- Hold-down timers. A router ignores updates about a failed route for a period, to avoid accepting stale information.
Link-state protocols avoid most of these loops because every router has the full map and computes the path itself. Short-lived loops are still possible while routers hold different versions of the map.
Flapping
A flapping link goes up and down repeatedly. Every change triggers flooding and recalculation across the network, which can overload routers and keep the network from ever settling. Protocols use throttle timers, and operators use dampening, to slow the reaction to unstable links.
Ways to shorten convergence
| Technique | What it improves | Cost |
|---|---|---|
| Shorter hello and dead timers | Detection | More control traffic and more risk of false failures on busy links |
| BFD | Detection | Extra CPU load and a risk of false alarms on unstable links |
| Faster SPF throttle settings | Computation | Less protection against flapping |
| Equal-cost multipath (ECMP) | Recovery | Traffic is already spread across several paths, so losing one only removes that path |
| Fast reroute | Recovery | Backup paths are precomputed and installed ahead of time, which needs more table space and protocol support |
| Floating static backup | Recovery for static designs | Manual configuration and a slower switch-over |
Tuning is a trade-off. Aggressive timers detect real failures sooner, but they also declare healthy neighbors dead when a link is briefly congested. That causes extra changes, which are worse than a slightly slower reaction.
Common errors
- Assuming a static route disappears when the next hop dies. It only disappears when the local interface goes down.
- Measuring convergence from the failure to the first new route. What matters to users is when traffic flows again, so include installation in the forwarding hardware.
- Tuning timers on one side only. Both neighbors must agree on hello and dead intervals in OSPF, or the adjacency does not form.
- Setting very short timers on links that carry bursts. A congested link can drop hellos and cause a false failure.
- Testing only the cable-pull case. Also test a silent failure through an intermediate switch, because that case depends on timers.
Exercise
R1 reaches 10.2.0.0/16 through a static route via R2. A switch sits between R1 and R2. R2 loses power, but R1's interface stays up. What happens to traffic from R1 to 10.2.0.0/16, and what two changes would let R1 recover without manual action?
Show answer
R1 keeps the static route installed, because its own interface is still up, so it keeps sending packets to R2 and they are lost (a black hole). To recover automatically, either run a dynamic routing protocol such as OSPF so that missed hellos remove the neighbor and its routes, or track the next hop with a probe such as an IP SLA ping so that the static route is removed when the probe fails, and add a floating static route through another next hop as a backup.
Exercise
An OSPF neighbor fails silently. With default broadcast timers (hello 10 seconds, dead interval 40 seconds), what is the longest the router can wait before it starts reacting, and which technique would reduce that wait to under a second?
Show answer
The router can wait up to 40 seconds, the dead interval, before declaring the neighbor down and starting recomputation. Enabling BFD for the OSPF neighbor reduces failure detection to well under a second.