Chapter 07 · Part II · Interior routing

Fast convergence: BFD & fast reroute

When a link dies, a link-state network has to notice, spread the news, recompute and rewrite its forwarding tables. Left to default timers that takes most of a minute. Tuned well, it takes a fraction of a second. With fast reroute, the router next to the break patches traffic around it in the time it takes to notice, and the rest of the network catches up at leisure. This chapter is about how each of those seconds is won back, and what goes wrong while routers disagree.

3 × 50 msa common BFD setting: miss three packets sent every 50 ms and the session is declared down after 150 ms (RFC 5880, section 6.8.4)
UDP 3784the destination port of single-hop BFD control packets, always sent with TTL 255 so they cannot come from further away (RFC 5881)
40 show long OSPF waits with RFC 2328's sample timers: hellos every 10 s, neighbor declared dead after four missed ones

Common mix-up: fast reroute is not fast convergence. Fast reroute is a local patch: the router beside the failure switches to a backup it computed in advance, and the routing protocol still converges afterwards at its normal pace. And BFD does not route anything at all. It only answers one question, very quickly: is my neighbor still there?

Where the time goes

The convergence budget

If the words "convergence" and "microloop" are new, start with dynamic routing on networks.jelia.nyc, whose section "Convergence: how fast is fast?" is the on-ramp to this chapter. Here we take the same four steps apart with a stopwatch.

The IETF's framework for IP fast reroute, RFC 5714, lists what happens after a failure in a link-state network such as OSPF or IS-IS, with rough numbers for each step. First the routers next to the failure have to detect it: a few milliseconds if the physical layer reports it, "up to several tens of seconds when a routing protocol Hello is employed." Then they originate new link-state advertisements, often after a deliberate hold-down. The news is flooded to every other router, which the RFC puts at 10 to 100 milliseconds per hop. Each router recomputes its shortest-path tree, typically a few milliseconds of Dijkstra. Finally each router installs the changed routes into its forwarding hardware, which RFC 5714 calls "very implementation dependent" and which "may be several hundred milliseconds."

Traffic is lost for the whole of that chain, and the chain is only as fast as its slowest link. Two parts dominate in practice. Detection dominates when it relies on hellos, because a protocol hello timer is measured in seconds. Once detection is fast, installation tends to dominate, because a router may have to rewrite tens or hundreds of thousands of forwarding entries one by one, and the last prefix in the queue waits for all the others.

That last problem has a structural fix. In a flat forwarding table, each of a hundred thousand prefixes stores its own next hop, so a failure means a hundred thousand writes. In a hierarchical table, the prefixes all point at one shared "path list" entry, and only that entry holds the next hop. A failure then means one write, whatever the number of prefixes. This is called prefix-independent convergence (PIC): the recovery time no longer grows with the size of the table.

StepWhat happensTypical size (RFC 5714)What shrinks it
DetectRouters beside the failure notice itA few ms (physical layer) to tens of seconds (hellos)Carrier signalling, BFD
OriginateNew LSAs are built, often after a hold-downSet by a throttle timerShort initial throttle delay
FloodThe LSAs reach every router in the area10 to 100 ms per hopFast flooding, a flatter network
ComputeEach router reruns SPFA few msIncremental SPF, small SPF delay
InstallChanged routes are written into the FIBImplementation dependent, may be several hundred msPrefix-independent convergence, prioritizing important prefixes
Go deeper: why PIC needs a hierarchical FIB, and who uses it

The idea is easiest to see with BGP. A provider-edge router may carry several hundred thousand BGP routes, nearly all of which resolve through a handful of BGP next hops, which in turn resolve through IGP routes (the recursion is explained in Chapter 3). If the forwarding hardware stores the resolution as a chain, prefix → BGP next hop → IGP path, then an IGP failure changes one IGP path entry and every BGP prefix behind it is repaired at once. That is "PIC core." If a BGP next hop itself disappears, a precomputed backup BGP next hop in the same shared entry gives "PIC edge."

The behavior is described in the IETF working-group draft "BGP Prefix Independent Convergence" (draft-ietf-rtgwg-bgp-pic); it is implementation work in the forwarding plane rather than a change to any protocol on the wire, which is why it can be deployed by one router without its neighbors' cooperation.

Instrument 1

The convergence calculator

Choose how failures are detected and set the delays for each later step. The top bar adds them up the way RFC 5714 does: detect, wait, flood, compute, install. The bottom bar is the same failure with fast reroute and a prefix-independent FIB, where the router beside the failure only has to detect and flip one pointer. Packet loss assumes your traffic is spread evenly over the prefixes, so on average a packet waits for half of the install queue. Try the hello timers, then BFD, then a million prefixes with and without PIC.

Detection–
Protocol recovery (avg)–
Last prefix restored–
With fast reroute–
Packets lost–
Lost with fast reroute–

Noticing in milliseconds

Listening for silence: BFD

The cheapest detection is the one the hardware gives you for free. When a fiber is cut between two routers that are directly connected, the receiving optics lose light and the interface goes down within milliseconds; the routing protocol hears about it at once. This is carrier loss, and when it works, nothing beats it.

It often does not work. Two routers may be joined through a switch, a transport system or a provider's Ethernet service. If the far router crashes, or a line card stops forwarding while its laser stays lit, every light on the near router stays green. The only way to find out is to notice that the neighbor has stopped talking. OSPF and IS-IS do this with their own hellos, but those are designed for adjacency, not for speed: RFC 2328 gives 10 seconds as a sample hello interval and suggests declaring a neighbor dead after "some multiple of the HelloInterval (say 4)." That is 40 seconds of black hole.

Bidirectional Forwarding Detection (BFD, RFC 5880) is a protocol that does nothing but this. Two routers agree to send each other small control packets at a fixed interval. In the usual asynchronous mode, each side simply expects to keep hearing from the other. If a router hears nothing for a whole detection time, it declares the session down and tells every protocol that registered an interest (RFC 5882 describes how OSPF, IS-IS, BGP and static routes use it). Because BFD is so simple, it can run on a line card or in hardware, far away from the busy routing process, which is what lets it run at intervals of tens of milliseconds.

The detection time is not sent in the packet. Each receiver works it out from two negotiated numbers: the interval, the greater of what the sender wants to send and what the receiver is willing to receive, and the sender's detect multiplier, roughly the number of packets that may be missed in a row.

Detection time = Detect Mult (remote) × max(Required Min RX (local), Desired Min TX (remote))
In words: the slower of the two sides sets the pace, and the far end's multiplier says how many beats may be skipped. With 50 ms both ways and a multiplier of 3, a dead neighbor is declared after 150 ms. FRRouting's documented default of 300 ms × 3 gives 900 ms.

For a session between directly connected routers, RFC 5881 puts the control packets in UDP to destination port 3784 and requires the IP TTL (or IPv6 hop limit) to be exactly 255 on sending and receiving. Any packet that has crossed even one router arrives with 254 or less and is thrown away, so a spoofer elsewhere on the internet cannot keep a dead session alive or kill a live one; this is the same trick as the Generalized TTL Security Mechanism in RFC 5082. The packet itself is small and fixed, 24 bytes before any authentication:

BytesFieldWhat it says
0Version (3 bits) · Diagnostic (5 bits)Version 1; why the last session went down (1 = control detection time expired, 3 = neighbor signaled down, 7 = administratively down, and so on)
1State (2 bits) · P F C A D M flagsAdminDown, Down, Init or Up; Poll and Final for changing timers safely; C means BFD runs independently of the control plane
2Detect MultHow many intervals the receiver may wait, for example 3
3Length24 without authentication
4–7My DiscriminatorA number the sender chose to name this session
8–11Your DiscriminatorThe number the other side chose, echoed back, or 0 while still unknown
12–15Desired Min TX IntervalHow often I would like to send, in microseconds (50,000 = 50 ms)
16–19Required Min RX IntervalThe fastest I am willing to receive, in microseconds
20–23Required Min Echo RX Interval0 if I will not loop back echo packets

A session comes up with a three-way handshake through the states Down, Init and Up, and while it is not Up the RFC requires sending no faster than once a second, so a misconfigured peer cannot be flooded. In echo mode, a router sends packets addressed to itself to UDP port 3785 across the link; the neighbor forwards them straight back in its data plane, testing the real forwarding path without the neighbor's software doing any work.

Go deeper: how fast is too fast?

Aggressive timers cut both ways. A session at 3 × 10 ms declares failure after 30 ms of silence, which is also how long a busy control processor, a congested queue or a brief optical hit might take. A false "down" causes exactly the reroute you were trying to avoid, and if it repeats, flapping. Operators therefore pick intervals the hardware can sustain (hardware-offloaded BFD is far steadier than BFD run in software), and many implementations add dampening that holds a flapping session down for a while. The protocol itself is careful here: RFC 5880 uses a Poll/Final exchange so that timers are only shortened after both sides agree.

For sessions that are not one hop apart, such as BGP between loopbacks, RFC 5883 defines multihop BFD on UDP port 4784, where the TTL check cannot apply and authentication matters more.

Waiting on purpose

Why routers pause before SPF

If fast is good, why would a router ever wait before running SPF? Because one failure is rarely one event. When a router dies, every one of its neighbors detects a link loss, each a few milliseconds apart, and each floods its own LSA. A router that ran SPF on the first LSA would compute a picture that is wrong a moment later, install it, then do it all again. During a flapping link it might do this many times a second, burning CPU and churning the forwarding tables of the entire area.

So implementations throttle with an exponential back-off. The first event after a quiet period triggers SPF after a short delay. If more events keep arriving, the next run is held off longer, and longer, up to a ceiling. Once the network has been quiet for a while, the delay snaps back to the short value. FRRouting's OSPF documentation gives the example timers throttle spf 200 400 10000: wait 200 ms after an event, then keep runs at least 400 ms apart, growing by 400 ms each time another event lands inside the hold time, never more than 10 seconds.

Different vendors' algorithms used to differ, and if two neighbors run SPF at different moments their forwarding tables disagree for longer, which breeds the microloops later in this chapter. RFC 8405 therefore standardizes one back-off algorithm for link-state IGPs, with an INITIAL delay for a single isolated event (its example is 0 ms), a SHORT delay while the rest of one component failure arrives (50 to 100 ms), and a LONG delay when the network is unstable (2 seconds), returning to INITIAL after a HOLDDOWN interval of quiet (3 seconds in its example).

SPF back-off: the first event is handled quickly, a burst of events stretches the wait, and quiet resets it. time → events (LSAs) short wait,quick SPF burst: wait longer still busy: longer again quiet periodresets: quick again waiting SPF run
Back-off in pictures. Triangles are incoming events, amber bars are the throttle wait, blue bars are SPF runs. A lone failure is answered in milliseconds; a storm is answered calmly.
Repair before the news arrives

Loop-free alternates

Even with BFD and short throttles, the routers far from a failure need flooding, SPF and FIB writes before they move. The routers right beside the failure are the ones that know first, and they are also the ones dropping traffic. RFC 5714 calls such a router the point of local repair, and IP fast reroute (IPFRR) is the idea of giving it a backup next hop, computed and installed before anything fails. When BFD fires, it switches to the backup in the data plane, in milliseconds, while normal convergence carries on behind it.

The catch is that the backup neighbor will forward the packet using its own routing table, which still describes the network before the failure. If that neighbor's best path to the destination runs back through the repairing router, the packet comes straight back and loops. RFC 5286 gives the test a neighbor must pass to be a safe backup, a loop-free alternate (LFA). Write S for the repairing router, D for the destination, N for a candidate neighbor and Distance(X, Y) for the shortest-path cost from X to Y before the failure:

Distance(N, D) < Distance(N, S) + Distance(S, D)
In words: N's own best route to D must be strictly cheaper than going back to S and on from there. If it is, N's shortest path cannot pass through S, so a packet S hands to N will not be handed back. RFC 5286 calls this Inequality 1, the loop-free criterion.

A worked example. S reaches D through E: S to E costs 1, E to D costs 1, so Distance(S, D) = 2. S has another neighbor N, with S to N costing 1 and N to D costing 2. Then Distance(N, D) = 2, Distance(N, S) = 1, and the test reads 2 < 1 + 2, which is true: N is an LFA. Now raise the N to D cost to 4. N's best route to D is now back through S and E, cost 3, and the test reads 3 < 1 + 2, which is false. Hand N a packet for D and it returns it to S. The same neighbor, with one cost changed, stops being safe.

RFC 5286 adds two stronger conditions. A downstream path (Inequality 2) requires Distance(N, D) < Distance(S, D): N is strictly closer to the destination than S is, a stricter test that also rules out loops when neighboring routers are repairing at the same time. A node-protecting LFA (Inequality 3) requires Distance(N, D) < Distance(N, E) + Distance(E, D), where E is the primary next hop: N's path avoids E itself, so the backup survives if the whole router E died rather than just the link to it. A neighbor that passes only Inequality 1 protects the link.

Whether an LFA exists depends entirely on the shape of the network and its costs. Meshes and triangles are generous. Rings are hostile: in a ring with equal costs, the neighbor on the other side of S usually reaches the far part of the ring through S, so it fails the test. That is not a curiosity; many metro and access networks are rings.

Left: N reaches D directly and is a loop-free alternate. Right: after the N to D cost rises to 4, N's best path runs back through S and the test fails. 1112 1114 SEDN SEDN 2 < 1 + 2 : LFA ✓ 3 < 1 + 2 is false : loops ✗
The loop-free test with real numbers. Solid blue is the primary path; the dashed line is where N would send a packet for D.
Instrument 2

The LFA finder

This runs Dijkstra from every router on the topology below and applies RFC 5286's three inequalities to each neighbor of S, with the real numbers in the table. Pick what a tap does, then tap routers and links. If no neighbor passes, it computes S's extended P-space and E's Q-space for remote LFA (next section), and as a last resort the post-convergence path TI-LFA would use. The coverage line repeats the whole calculation for every destination. Load the six-router ring to watch LFAs fail, then lower one cost and watch them return.

1
Primary path–
Repair–
P-space ∩ Q-space–
Coverage for this link–
Neighbor NDist(N,D)Dist(N,S)+Dist(S,D)Loop-free (1)Downstream (2)Node-protecting (3)

When no neighbor will do

Remote LFA and TI-LFA

If no direct neighbor is safe, perhaps a router further away is. That is the idea of remote LFA (RFC 7490): S sends the packet through a tunnel to a distant router that, from where it sits, will forward it to the destination without being drawn back towards the failure. The tunnel makes the distant router behave like a neighbor.

The tunnel endpoint has to satisfy two conditions, and RFC 7490 names them as two sets of routers. The P-space of S, with respect to the protected link S–E, is every router S can reach on its normal shortest paths without any of them (equal-cost splits included) crossing S–E. Packets tunnelled to a router in P-space will get there despite the failure. Because S can also use its neighbors' views, the RFC defines an extended P-space: the union of the P-spaces of S's other neighbors. The Q-space of E is every router from which E can be reached without crossing S–E. Packets released at a router in Q-space travel on normally without needing the broken link. A router in both is a PQ node, and it is where the tunnel ends.

RFC 7490's own example is a ring of six routers, S, E, D, C, B and A, all links costing 1. When S–E fails, traffic to D and E cannot be protected by plain LFAs. S can reach A and B without the link, and through its neighbor A it can also reach C: that is the extended P-space. D and C can reach E without the link; B cannot, because one of its two equal-cost paths to E runs through S. The only router in both sets is C, so S tunnels to C and C delivers to D and E. The LFA finder above reproduces exactly this when you load the ring.

Remote LFA still leaves gaps: in some topologies P-space and Q-space do not touch. Topology-independent LFA (TI-LFA, RFC 9855, published October 2025) closes them by using segment routing, which lets the source write a short list of waypoints, and even specific links, into the packet header. With that, S can steer a packet from the last router in P-space across the gap to the first router in Q-space. TI-LFA also chooses its repair along the post-convergence path, the path the network will settle on once it has converged, so traffic moves once to its final route rather than twice. The RFC states the result plainly: guaranteed coverage "in any two-connected networks using a link-state IGP." If the network is still connected after the failure, TI-LFA can protect it.

MechanismBackup goes toNeedsCoverage
LFAA direct neighbor that passes RFC 5286's testNothing extraDepends on topology; poor in rings
Remote LFAA PQ node, through a tunnelA tunnel (often MPLS LDP)Better; still topology dependent
TI-LFAA segment list along the post-convergence pathSegment routingAny single link or node failure in a two-connected network
Go deeper: the BGP side, graceful restart versus fast failover

BGP has its own version of the trade-off, with the opposite instinct. Graceful restart (RFC 4724) is for a router whose control plane restarts while its forwarding hardware keeps running, for example during a software upgrade. It announces in advance that it can preserve forwarding state, and its neighbors, acting as helpers, keep using its routes for a configured restart time instead of withdrawing them. Once the session is back, an End-of-RIB marker tells each side the other has finished resending its routes.

That is the right thing when forwarding really is intact, and exactly the wrong thing when the router has actually died, because helpers will keep sending traffic into it. Fast failover goes the other way: BFD on the BGP session tears it down in a fraction of a second, and a precomputed backup path (PIC edge, above) takes over. Many networks use both, letting BFD decide which situation they are in. Sessions and timers are covered in Chapter 8.

While routers disagree

Microloops

Convergence is not one event but many, scattered over a few hundred milliseconds. Each router finishes detecting, flooding, computing and installing at its own moment, and RFC 5714 points out that the install step varies the most from one router to another. In between, some routers forward by the new topology and some by the old. If a router with the new picture sends a packet to a router with the old picture, and the old picture says "send it back," the packet bounces between them. That is a microloop: a forwarding loop that exists only during convergence.

A microloop is not harmless just because it is brief. Each looping packet crosses the same link again and again until its TTL runs out, so a loop at line rate fills that link with copies, and traffic that was never affected by the failure gets caught in the congestion. Fast reroute does not help either, unless it is held in place: the moment the repairing router installs its new route, it stops using its carefully loop-free backup and may point straight into a neighbor that has not caught up.

RFC 5715 is the framework for loop-free convergence and surveys the cures. One family controls the order in which routers update: in an ordered FIB scheme, routers update in a sequence chosen so that no router ever points at one that still points back. A simpler, widely used case is RFC 8333's local convergence delay. Its observation is that many microloops involve the router right next to the failure, which detects first and updates first. So that router deliberately waits: it keeps forwarding on its fast-reroute repair, which is loop-free, while the rest of the network converges, and only then installs its own new route. RFC 8333 limits this to link-down events and says it may only be used when fast reroute protects the traffic during the wait, or for planned maintenance. Its simulations on real topologies found that these local loops were more than half of all forwarding loops.

Instrument 3

Make a microloop, then prevent it

Traffic for D enters at R1 and normally runs R1 → R2 → D. At time zero the R2–D link fails. R2's new best path is back through R1 (cost 1 + 5), and R1's new best path is its own direct link to D (cost 5). The simulator sends a packet every 2 ms, moves each one hop per millisecond, and decides every hop from the forwarding table each router has at that instant. Set when each router updates and see what happens to every packet. Then turn on fast reroute and the RFC 8333 local delay.

Delivered normally–
Delivered by repair–
Lost on the dead link–
Dropped, no route–
Died in the loop (TTL)–
Most bounces by one packet–

Go deeper: why the simulation's numbers are a model, not a measurement

The simulator uses one millisecond per hop and one packet every 2 ms to keep the picture readable. Real links serialize a packet in microseconds, so a real microloop at line rate makes far more trips per packet and fills the link far faster. The shape of the result is what carries over: packets are lost before detection whatever you do; between detection and the moment both routers agree, it is the order of their updates that decides between delivery and a loop.

Cheat sheet

Terms from this chapter

Convergence budget
The time from a failure to working forwarding again: detect, originate and flood, compute, install.
BFD
Bidirectional Forwarding Detection (RFC 5880): a lightweight heartbeat between neighbors that declares a path down after a set number of missed packets.
Detect multiplier
BFD's count of intervals that may pass without a packet before the session is declared down; 3 × 50 ms gives 150 ms.
SPF throttling
Delaying shortest-path runs with an exponential back-off so a burst of events causes one calculation, not dozens (RFC 8405).
PIC
Prefix-independent convergence: a hierarchical FIB in which many prefixes share one next-hop entry, so one write repairs them all.
Point of local repair
The router beside a failure that switches traffic onto a precomputed backup (RFC 5714).
LFA
Loop-free alternate: a neighbor N with Dist(N, D) < Dist(N, S) + Dist(S, D), safe to use as an instant backup (RFC 5286).
PQ node
A router S can reach without the failed link (P-space) that can also reach the far end without it (Q-space); the endpoint of a remote-LFA tunnel (RFC 7490).
TI-LFA
Topology-independent LFA: a segment-routing repair along the post-convergence path, covering any single failure in a two-connected network (RFC 9855).
Microloop
A short-lived forwarding loop while routers' tables disagree during convergence; prevented by ordering updates or a local delay (RFC 5715, RFC 8333).
Where this comes from

Sources