Skip to content

Linux Foundations / Follow traffic and find the fault ยท Step 21 of 46

Lesson: Distance Vector ProtocolsSwitch
โ† Linux Foundations

Network operations

Distance Vector Protocols

Understand how routers share distances with neighbours, using RIP as the example.

In a distance vector protocol, a router does not have a map of the network. It only knows what its neighbours tell it: "I can reach network X at this distance." The distance is the metric, and the neighbour gives the direction, or vector.

How routes spread

Picture three routers in a row: A, B and C. Network X is connected to C.

  1. C tells B that it can reach X.
  2. B records "X via C" and tells A, with a higher metric.
  3. A records "X via B".

A has no idea that C exists. It trusts B. This is sometimes called routing by rumour.

If a router hears of two ways to the same network, it keeps the one with the lower metric.

RIP

RIP is the classic example. Its metric is the hop count. A metric of 16 means unreachable, so a usable path can be at most 15. RIP sends its table about every 30 seconds.

Hop count ignores speed: a two-hop path over slow links beats a three-hop path over fast ones. RIP version 2 adds subnet masks to the updates, and RIPng is the IPv6 version.

Count to infinity

Suppose C loses network X. B may still advertise an old route, and C could believe that B has another way to X. The two then raise the metric back and forth. The limit of 16 ends this.

Common protections are:

  • Split horizon: do not advertise a route back out of the interface it was learned from.
  • Poisoned reverse: advertise it back, but marked as unreachable.
  • Triggered updates: send changes soon, without waiting for the timer.

These reduce loops but do not remove every case.

On Linux

Linux does not run RIP by itself. A daemon such as FRR provides it. In FRR's vtysh shell, a minimal setup looks like this, after the ripd daemon has been enabled:

configure terminal
router rip
 version 2
 network 192.0.2.0/24

Learned routes can then be viewed with show ip rip. Distance vector protocols are easy to set up and suit small networks, but they converge more slowly than link state protocols. EIGRP, designed by Cisco, improves on the basic idea by keeping loop-free backup paths.

Try it

Draw four routers in a line with one network at the end. Write each router's metric and next hop for that network, one update round at a time. Then remove the network and work out how split horizon stops the neighbour from offering the route straight back. The networking basics guide helps if you want to revisit the terms.

Check your understanding

Distance Vector Protocols

All 4 sections ยท no timer

Unlimited retries

Questions from every section are combined into one assessment. Answer them all correctly to complete the article.

Your completion saves in this browser. Sign in to sync it to your account.