The idea
Nobody at this ski resort has typed a route in twenty years, because the routers tell each other what they can reach. Bring the new summit router into the conversation, find out why it picks the slowest link on the mountain, then lose the bad news on its way down and watch a rumor about a dead network run in circles.
Steps
-
Join the conversation
A ski resort runs four routers in a ring around the mountain. Fiber climbs from
valleyRouterthroughforestRouterandridgeRoutertosummitRouter, and an old radio link,radioLink, jumps straight from the valley to the summit. The ticket server sits in the valley, and the scannersummitGateat the top of the lift asks it about every pass.In the
static-routeslab you typed each route by hand and repaired each failure yourself. Four routers in a ring would need a line on every router for every network, each pointing the right way, and one failure could mean changing most of them. A routing protocol does that work for you: it's software on each router that talks to the routers beside it and fills in the table from what it hears.RIP, the Routing Information Protocol, is the oldest of these still running, and its messages are short enough to read by eye. Three of these routers already speak it.
summitRoutercame out of its box this morning and doesn't, so the scanner can't reach anything past that router.Ping the ticket server from
summitGate, read the summit's table, then turn RIP on for the router's cards and look again.summitGate:~# ping -c 1 -W 2 10.0.1.10 summitRouter:~# vtysh -c "show ip route" summitRouter:~# vtysh -c "configure terminal" -c "router rip" -c "network 10.0.0.0/8" summitRouter:~# vtysh -c "show ip route" summitGate:~# ping -c 1 -W 2 10.0.1.10
-
Listen to the gossip
Those routes came from somewhere, and RIP's messages are ordinary packets that anyone on the wire is free to read.
forestRouterhas a neighbor on each side, which makes it a good place to listen. The lab records on both its cards for a few seconds while you ask it for its settings.The design is old. It grew out of Xerox's networks in the late 1970s, and Berkeley's Unix shipped a program called
routedthat spoke it, which put it on university machines across the early internet. It was written down as a standard only in 1988, as RFC 1058, long after it was everywhere.Version 2 came in the 1990s and added the
/24you'll see on each line. Version 1 sent addresses with no mask, and that stopped working once networks came in every size. The version is a setting on each router, and a router set to one version refuses the other.Every RIP router does one small job. On a steady beat it sends a list of the networks it knows and how far away each one is, and when a list arrives it adds one to each distance and keeps any route that beats what it has. News from the neighbor it already uses always counts, even when the number gets worse.
Distance here is a count of hops. A network on a router's own card counts as 1, and each router further on adds 1.
So a router ends up with a direction and a distance for each network, and what it sends its neighbors is a list, or vector, of distances, which is why this family is called distance vector.
Look at what's missing. No router ever learns the shape of the network, in the same way that a road sign saying "Lyon 40 km" tells you nothing about the roads. Each router knows only what its neighbors claim, and it believes them.
forestRouter:~# vtysh -c "show ip rip status" summitRouter:~# vtysh -c "show ip rip"
-
Pay for the slow radio
The radio is one hop from the valley to the summit, and the fiber is three, so RIP sends every pass check over the radio. It's a 2 megabit link with 40 ms of delay each way, kept from the days before the fiber was laid. RIP's metric has no room for speed, so it will prefer a slow link with fewer hops every time.
Ping the ticket server and trace the path to see what the scanners live with. Then make the radio look worse: an offset list puts a penalty on routes heard through a card.
The numbers need care. Over the fiber the summit hears the ticket office at metric 4, which is the 3 the ridge offers plus one hop.
Over the radio the valley offers 1, since the ticket office sits on its own card. A normal hop would add one to that, and in FRR an offset takes the place of that one, so an offset of 4 turns the 1 into 5, and 5 loses to 4. An offset of 3 would make a tie at 4, and on a tie FRR's RIP stays with the route it already has.
Add the offset on
summitRouterand ping, then add it onvalleyRouterand ping again.summitGate:~# ping -c 3 -W 2 10.0.1.10 summitGate:~# traceroute -n -w 1 10.0.1.10 summitRouter:~# vtysh -c "configure terminal" -c "access-list all-routes permit any" -c "router rip" -c "offset-list all-routes in 4 radioLink" summitGate:~# ping -c 3 -W 2 10.0.1.10 valleyRouter:~# vtysh -c "configure terminal" -c "access-list all-routes permit any" -c "router rip" -c "offset-list all-routes in 4 radioLink" summitGate:~# ping -c 3 -W 2 10.0.1.10 summitGate:~# traceroute -n -w 1 10.0.1.10
-
Cut a link quietly
In the
static-routeslab you broke a provider's network while the cards stayed up, and the route went on sending packets into nothing. RIP runs a different test: a neighbor has to keep renewing each route, and silence kills it.The lab is about to lose every packet on
forestRidgeand leave the cards up, so no router gets told anything. While it does, a loss meter onsummitGatesends a ping every 0.2 seconds for 35 seconds, then reports the longest gap. The fiber comes back at the end of this step.summitGate:~# ping -i 0.2 -c 175 -W 1 10.0.1.10 summitRouter:~# vtysh -c "show ip rip" forestRouter:~# ip -br link show forestRidge
-
Send the bad news
Silence is how RIP finds a link that dies quietly. A failure the router can see for itself needs no waiting, because a card that goes down is a fact.
Take the card
summitGatesdown onsummitRouter, as if someone had pulled the cable to the gates' network, while the lab records what crossesforestRouter. This cuts off the scanners until you bring the card back at the end of this step.summitRouter:~# ip link set summitGates down ticketServer:~# ping -c 2 -W 2 10.0.2.10 summitRouter:~# ip link set summitGates up ticketServer:~# ping -c 2 -W 2 10.0.2.10
-
Lose the bad news
That worked because every message arrived. RIP's messages travel over UDP, so nobody acknowledges them, and a router that sends bad news has no idea whether it landed.
The lab is about to make the fiber between
ridgeRouterandforestRouterlose every RIP message going downhill. It has also givenforestRoutera 50-minute timeout in place of 15 seconds, so that its own countdown can't end the fault while you look at it. A real link wouldn't need this long: lose one message, and if the valley's regular list reaches the summit before the ridge repeats the news, the same thing happens.Take
summitGatesdown again, and follow the news. It reaches the ridge, and the ridge's message to the forest is lost. It also crosses the radio to the valley, and the valley ignores it, because the valley's route goes through the forest and bad news only counts from the neighbor in use.So
forestRouterandvalleyRouterstill believe the scanners are up there, andvalleyRoutergoes on saying so in its regular list, over the radio, to the very router that lost them.summitRouter:~# ip link set summitGates down ticketServer:~# ping -c 2 -W 2 10.0.2.10 forestRouter:~# vtysh -c "show ip route 10.0.2.0/24" ridgeRouter:~# vtysh -c "show ip route 10.0.2.0/24" summitRouter:~# vtysh -c "show ip route 10.0.2.0/24" valleyRouter:~# vtysh -c "show ip route 10.0.2.0/24"
-
Count up to infinity
Four routers are holding a false route, and nothing is coming to save them: the forest's countdown is 50 minutes long, and the messages that could correct it are being lost.
Repair the link by deleting the rule on
ridgeRouterthat's losing those messages. The lab records RIP's packets onsummitRouterfor 12 seconds after you do. The scanners' network stays down until the end of this step.ridgeRouter:~# iptables -D OUTPUT -o forestRidge -p udp --dport 520 -j DROP ticketServer:~# ping -c 2 -W 2 10.0.2.10 summitRouter:~# ip link set summitGates up ticketServer:~# ping -c 2 -W 2 10.0.2.10
Run these steps on real machines
Keep reading
- Routing Information Protocol: Explaining One of the Oldest Routing Protocols, a short history and worked example article
- Networking Basics: How RIP Works, Kevin Wallace's walkthrough of the hop count video
- Computer Networks: A Systems Approach, section 3.4 on distance vector and link state routing book