Sub topic 9
Split horizon, poison reverse, hold-down, and maximum metric
This chapter covers the four techniques distance-vector protocols use to limit routing loops and count to infinity. It assumes you know basic IP addressing, what a routing table is, and how the Bellman-Ford update works from the earlier chapters. All of the techniques are heuristics. They reduce the problem but do not remove it.
The problem being solved
In a distance-vector protocol, a router trusts its neighbors' advertisements. If a destination becomes unreachable, routers can keep handing each other stale routes that point back at one another. Each exchange raises the cost by one link cost. This is count to infinity.
Take a chain A - B - C, where C is the only router attached to network N. B reaches N through C at cost 1, and A reaches N through B at cost 2. If C loses N, C needs a new route. B still advertises "N at cost 1" to C. C may accept this, because the advertisement comes from a neighbor, and install "N via B at cost 2". B then learns from C that N costs 2 and updates to 3. The two routers keep raising the cost while packets bounce between them.
Split horizon
Split horizon is a rule about what a router advertises. A router does not advertise a route back out of the interface it learned that route from. B learned N from C, so B leaves N out of its advertisements to C.
This removes the two-router loop above. C has no stale advertisement from B to accept, so after N fails C simply has no route. Split horizon is cheap, because it only filters the outgoing vector, and it needs no extra state.
Poison reverse
Poison reverse is a stronger version of split horizon. Instead of omitting the route, the router advertises it back with the maximum metric, which means unreachable. B tells C "N costs 16" (in RIP).
The difference is speed. With plain split horizon, C learns that B is not a path to N only because B stays silent, and C has to wait for a timer to confirm that. With poison reverse, B states it explicitly. A wrong route is removed on the next update.
The cost is larger messages, since every route appears in every advertisement. The advertise_to function from this tutorial's code shows both behaviors with a single flag:
INFINITY = 16
def advertise_to(me, neighbor, table, poison_reverse=True):
out = {me: 0}
for dest, (cost, next_hop) in table.items():
if next_hop == neighbor:
if poison_reverse:
out[dest] = INFINITY
else:
out[dest] = cost
return out
table = {"N": (1, "C"), "M": (2, "A")}
print(advertise_to("B", "C", table, poison_reverse=False))
print(advertise_to("B", "C", table, poison_reverse=True))The first call prints {'B': 0, 'M': 2}. The second prints {'B': 0, 'N': 16, 'M': 2}.
Why split horizon is not enough
Both techniques work only between two neighbors. In a triangle or a larger cycle, a stale route can travel around the loop. Suppose A, B, and C form a triangle and all reach N through C. When C loses N, B can still hear a stale "N at cost 2" from A, whose route actually goes through C. B accepts it, because A is not B's next hop for N. The advertisement from B to A is then not filtered either, since B learned N from A only after the failure. Costs again climb around the cycle.
This is why protocols add two more mechanisms.
Maximum metric
Count to infinity is bounded by choosing a finite value that means "infinity". RIP uses 16. When a route's cost reaches 16, the route is unreachable and is removed.
Without a limit, the cost would rise forever. With a limit, the loop ends after a bounded number of rounds. The limit also fixes the size of the network: RIP supports paths of at most 15 hops, because a longer path would be indistinguishable from an unreachable one.
Choosing the value is a trade-off. A small maximum metric ends loops quickly but restricts network diameter. A large one allows larger networks but lets loops last longer. In the update code, min(link_cost + adv, INFINITY) is the line that clamps costs at this value.
Hold-down
Hold-down is a timer rule. When a router learns that a route has become unreachable, it starts a hold-down timer for that destination. During this period it ignores advertisements for the destination that claim a path of any other cost, unless they come from the original next hop or carry a better metric than the original one. After the timer expires, the router accepts new information.
The idea is to give the failure news time to reach every router before any router accepts a possibly stale alternative. The stale advertisement from A in the triangle example would be ignored during hold-down.
The cost is slower recovery. A valid backup route is also ignored until the timer expires. Hold-down is part of Cisco's IGRP and its RIP implementation, and it is not part of the original RIP specification.
| Technique | What it does | Limit |
|---|---|---|
| Split horizon | Omits a route from advertisements sent toward its next hop | Fails in cycles of three or more routers |
| Poison reverse | Advertises such routes as unreachable | Larger messages, same cycle limit |
| Maximum metric | Treats a finite cost as infinity | Caps network diameter |
| Hold-down | Ignores worse alternatives for a timed period | Delays valid backup routes |
Related technique: triggered updates
Periodic updates are slow. RIP sends them every 30 seconds. A triggered update is sent immediately when a route changes, so failure news spreads in a fraction of a second instead of waiting for the next timer. Triggered updates are usually combined with the techniques above.
Practical consequences
- Poison reverse is usually left on, because its extra message size is small for typical routing tables.
- Split horizon can cause trouble on non-broadcast multi-access links, where one interface reaches several neighbors. A route learned from one neighbor is then not advertised to the others on the same interface, and those neighbors never hear it. Disabling split horizon on such interfaces is a known fix.
- Maximum metric is a design limit. If your network has paths longer than 15 hops, RIP is the wrong protocol.
Exercise
Routers X, Y, and Z form a triangle. All three reach network N through Z. Z loses N. Explain why split horizon between each pair does not fully prevent a loop, and name one mechanism that eventually ends it.
Show answer
X advertises N to Y, and Y advertises N to X, but each learned N from Z, not from each other. After Z loses N, X can still hold a stale route "N via Z" and advertise it to Y. Y's next hop for N is Z, not X, so Y may accept X's stale route. Y then advertises N to X, whose next hop is now Y, and the filter only applies to Y itself. Costs rise around the cycle. The maximum metric (16 in RIP) ends this by declaring the route unreachable once the cost reaches the limit. Hold-down also helps by ignoring the stale advertisement.
Exercise
Why does RIP's maximum hop count of 15 limit the size of a RIP network?
Show answer
Cost 16 means unreachable, so a real path of 16 hops cannot be told apart from a failed route. Any destination more than 15 hops away is therefore unusable.