Kahibaro
Discord Login Register

10.1 Distance Vector Routing

Introduction

Distance vector routing is one of the fundamental approaches that routers use to automatically exchange routing information and build routing tables. In this chapter you will see what is unique about distance vector protocols, how they think about the network, and what typical behaviors and limitations they have, without going deeply into any specific protocol such as RIP. Those concrete protocols are covered separately.

The Core Idea: Routing by “Distance” and “Direction”

A distance vector protocol describes the network in terms of two simple pieces of information for each destination network: how far away it is and in which direction to send traffic.

The word “distance” is a metric such as hop count or some cost value. The word “vector” means a direction, practically the next hop router to use. Each router stores, for every known destination, a best distance and the next hop that provides that distance.

A distance vector router does not try to keep a full map of the network topology. It does not know every link and router relationship. Instead, it only knows what its neighbors tell it, and it chooses the best information among what it has heard.

How Distance Vector Routing Works Conceptually

At a high level, distance vector routing follows a repeating cycle of learning and updating.

Each router starts by knowing only about the networks that are directly connected to its own interfaces. It assigns those local networks a distance of 0 and treats them as reachable through itself.

The router then sends its routing information to its neighbors. This shared information is often called a routing table or routing vector. A neighbor that receives this vector examines each destination and computes a new total distance by adding the cost of the link to that neighbor to the advertised distance. If the new total distance is better than what the router currently has, it installs this as the new route, with the advertising neighbor as the next hop.

This exchange continues periodically, and also when significant changes occur. Over time, routers inform each other of better paths, improve their tables, and the whole network gradually converges on consistent best routes.

The Bellman Ford Perspective

Distance vector routing is typically based on the Bellman Ford algorithm. The mathematical idea is that the best path to a destination can be found by repeatedly improving estimates of the distance, using information from neighbors.

At each iteration, a router $R$ updates its distance to a destination $D$ using the following logic. For each neighbor $N$, it considers the cost to reach $N$ plus the cost that $N$ reports to reach $D$. The router chooses the neighbor that yields the smallest result.

In a compact form, for each destination $D$:

$$
d_R(D) = \min_{N \in \text{neighbors of } R} \bigl( c(R,N) + d_N(D) \bigr)
$$

Here $d_R(D)$ is the distance from router $R$ to destination $D$ and $c(R,N)$ is the cost of the link between $R$ and its neighbor $N$.

Bellman Ford update rule:
For each destination $D$, a router chooses the neighbor $N$ that minimizes
$c(R,N) + d_N(D)$, and sets that as its new distance and next hop.

You do not need to implement Bellman Ford to use distance vector protocols, but understanding that the routers are repeatedly applying this kind of update helps explain their behavior.

Information Exchanged Between Routers

With distance vector, the basic information exchanged is extremely simple. Each router periodically sends its entire view of the network to its neighbors. That view is a list of destinations and their distances.

A typical announcement from router A to router B might have entries such as:

Destination networkDistance (metric)Next hop (from A’s view)
10.0.1.0/240directly connected
10.0.2.0/241router C
10.0.3.0/242router D

Router B receives this table from A and uses it to update B’s own distances, by adding the cost of the B to A link to each distance reported by A.

A key characteristic is that distance vector protocols traditionally send full routing tables, not just changes. Some modern variants try to reduce overhead by sending only updates when possible, but the basic model is full table advertisement.

Periodic Updates and Convergence

Distance vector routing relies on periodic updates. At regular intervals, each router sends its current routing table to its neighbors. This serves two main purposes. First, it lets neighbors learn about any new routes or better metrics. Second, it acts as a “keepalive” signal that confirms the neighbor is still present.

When the network is stable and no links fail, periodic updates may not change the routes, but they keep the topology knowledge fresh. If a link fails or a router disappears, neighbors will eventually detect that no more updates are received and will react by marking routes through that neighbor as invalid. New updates then spread this information outward.

The word “convergence” describes the state where all routers have updated their tables and agree on the best paths. Distance vector protocols typically converge more slowly than link state protocols, because each router only communicates with neighbors, and knowledge spreads step by step through the network.

Simple Metrics and Hop Count

A common feature of early distance vector protocols is the use of very simple metrics. The most basic one is hop count. In that case, every router to router link has the same cost, usually 1, and the distance to a destination is simply the number of router hops needed to reach it.

For example, if a path from R1 to R4 crosses three routers R1, R2, R3, and then R4, the hop count would be 3. Distance vector will prefer a path with a hop count of 2 over one with a hop count of 4.

Some distance vector protocols use more advanced metrics that reflect bandwidth, delay, or other properties, but a key idea remains the same. Each link has a cost and each router adds that cost to the advertised distance, then compares and picks the lowest total.

Counting to Infinity and Routing Loops

One of the most famous problems with distance vector routing is known as “counting to infinity.” It is closely related to routing loops.

A routing loop occurs when a packet is forwarded in a cycle among routers without ever reaching its destination. In distance vector protocols, loops can arise because routers only have partial knowledge based on neighbor advertisements. They do not have a full picture of the network, so they can be misled by outdated information.

Counting to infinity describes a particular failure scenario. Suppose a link to a destination network fails. One router detects the failure and marks the route as unreachable. However, another router may still advertise a path to that network based on old information that actually used the failed link. The first router then thinks there is an alternative path via that neighbor, so it increases the distance slightly and uses that neighbor. The neighbor in turn learns this new distance and thinks there is still another path, now via the first router. Both routers keep increasing the distance with each update, effectively “counting to infinity” as they slowly adjust their distance upwards to mark the route as bad.

To reduce how long this can continue, distance vector protocols typically define a maximum metric value that represents “infinity.” When the distance reaches this value, the destination is considered unreachable.

In classic distance vector, “counting to infinity” occurs when routers keep increasing a route’s metric in small steps after a failure, because they believe a path still exists through each other. A fixed maximum metric value is used to represent infinity and eventually stop the process.

Routing loops and counting to infinity are core weaknesses of naive distance vector behavior. Various techniques have been created to reduce these problems.

Loop Prevention Techniques

Distance vector designs include specific mechanisms that try to prevent or shorten routing loops.

One basic method is split horizon. With split horizon, a router does not advertise a route back out the interface from which it learned that route. If router A learned about network X from router B, A will not tell B that X is reachable through A. This simple rule cuts off many potential two router loops.

A related enhancement is split horizon with poison reverse. In this case, a router actively advertises a route back to the neighbor it learned it from, but marks it as unreachable by setting the metric to infinity. This informs the neighbor clearly that this router is not a valid path for that destination.

Triggered updates are another important feature. Instead of waiting for the regular periodic timer, a distance vector router sends an immediate update when it detects a significant change such as a route becoming unreachable. Triggered updates help the bad news travel faster and reduce the time that loops and wrong routes exist in the network.

Holddown timers are also used in some distance vector designs. When a route is marked as potentially unreachable, the router enters a holddown state for that route and temporarily ignores new, possibly incorrect advertisements about it. Only after the holddown period expires or a clearly better and trusted update is received will the router accept the new information. This slows down how quickly routers accept changes, which can help avoid unstable loops when the topology is flapping.

Distance Vector vs Link State at a High Level

Without going into full details of link state protocols, it is useful to contrast the two at a high level, because this reveals what is specific to distance vector.

Distance vector routers only talk to their immediate neighbors and share simple vectors of destination and distance. They do not know the full network map. Because of this, their logic is simpler, but they can be slower to converge and more vulnerable to loops.

Link state routers on the other hand attempt to build a complete picture of the network links and routers, then run a path calculation locally. This consumes more memory and CPU on each router, but it can lead to faster and more deterministic convergence.

Distance vector is usually easier to implement and configure for smaller or less complex networks, while link state is often preferred in larger and more dynamic environments. The choice is discussed further when studying specific routing protocols.

Typical Uses and Characteristics

Distance vector routing protocols historically appeared early in networking and were widely used inside small to medium size networks. Their configuration is usually straightforward, and their behavior is easy to understand at a conceptual level. They favor simplicity over performance.

Typical characteristics of distance vector protocols include:

They send periodic full routing table updates to neighbors.
They base route selection on a simple metric computed via Bellman Ford style updates.
They rely on techniques such as split horizon, poison reverse, and holddown timers to manage loops and instability.
They do not maintain a separate database of the entire topology, only a list of destinations, distances, and next hops.

Because of their limitations in large networks, many modern designs rely more heavily on link state or more advanced protocols, but distance vector concepts remain essential background knowledge and still appear in specific environments and legacy systems.

Summary

Distance vector routing is built on a simple idea. Each router tells its neighbors what it knows about the distance to each destination, and each neighbor chooses the best paths based on those reports. This model leads to straightforward operation but also introduces challenges such as slower convergence and potential loops. Understanding distance vector behavior, including the Bellman Ford idea, periodic updates, counting to infinity, and loop prevention techniques, prepares you to study specific distance vector protocols and to compare them effectively with other routing protocol families.

Views: 42

Comments

Please login to add a comment.

Don't have an account? Register now!