Sub topic 9
Split horizon, poison reverse, hold-down, and maximum metric
This chapter assumes you know how a distance-vector router builds its table from neighbor advertisements, and that you have seen count to infinity. You should also be comfortable reading short Python.
The problem to solve
Count to infinity happens because a router can accept a route from a neighbor whose own route actually runs back through the first router. Each exchange raises the metric by one, and the loop persists until the metric gets large. The four techniques below attack this from different sides.
Split horizon
Split horizon says: never advertise a route back out of the interface (or to the neighbor) it was learned from. If B reaches network N through A, B has no reason to tell A about N. A cannot be fooled into using B as a path to N.
Poison reverse
Poison reverse is a stronger variant. B still advertises N to A, but with the metric set to infinity. A hears an explicit "do not route through me" instead of silence. Silence has to time out, while an explicit unreachable message takes effect at once.
The function below builds the vector for one neighbor. It supports both behaviors.
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": (2, "A"), "M": (1, "C")}
print(advertise_to("B", "A", table, poison_reverse=False))
print(advertise_to("B", "A", table, poison_reverse=True))The first call prints {'B': 0, 'M': 1}. The second prints {'B': 0, 'N': 16, 'M': 1}.
Maximum metric
A maximum metric defines a finite value that means unreachable. RIP uses 16. When a count-to-infinity loop does occur, the metric climbs only to this ceiling and the route is then discarded. The cost is a limit on network size: RIP cannot use paths longer than 15 hops.
Hold-down
Split horizon only stops two-router loops. Larger loops need more. After a router learns that a route has failed, hold-down makes it ignore any advertisement for that destination for a fixed period, unless the advertisement comes from the original next hop or has a better metric. This gives the bad news time to spread before stale good news can re-enter.
The price is slower recovery. A destination that really did come back by another path stays unusable until the timer expires.
Comparing the techniques
| Technique | What it does | Limit |
|---|---|---|
| Split horizon | Omits routes toward the neighbor they came from | Stops only two-router loops |
| Poison reverse | Advertises those routes as infinity | Larger advertisements |
| Maximum metric | Caps the count | Limits network diameter |
| Hold-down | Ignores worse news after a failure | Slows recovery |
Exercise
Router B reaches network N through router A with cost 2. With poison reverse enabled, what does B advertise to A about N, and why is that better than omitting N?
Show answer
B advertises N with cost 16 (infinity). Omitting N leaves A relying on its own information, and any stale entry would have to age out. The explicit infinity tells A immediately that B is not a valid path to N.
Exercise
Why does a maximum metric of 16 limit how large a RIP network can be?
Show answer
Metrics of 16 mean unreachable, so any destination more than 15 hops away cannot be used.