Distance Vector, Link State, and Path Vector
Routing protocols are effectively distributed database systems. They propagate information about the topology of the network among the routers within the network. Each router in the network then uses this distributed database to determine the best loop free path through the network to reach any given destination. There are two fundamental ways to distribute the data through a network:
By distributing vectors, each router in the network advertises the destinations it can reach, along with some information which can be used to determine the best path to each reachable destination. A router can determine the best vector (path) by examining the destinations reachable through each adjacent router or neighbor, combined with some additional information, such as the metric, which indicates the desirability of that path. There are two types of vector-based protocols: distance vector and path vector.
By distributing the state of the links attached to the routers; each router floods (or advertises to all other routers in the network, whether directly adjacent or not), the state of each link to which it is attached. This information is used independently by each router within the routing domain to build a tree representing a topology of the network (called a shortest path tree). Routing protocols that distribute the state of attached links are called link state algorithms.
Each of these data distribution methods is generally tied to a specific method of finding the best path to any given destination within the network. The sections below provide a quick overview (or review) of each of these types of routing protocols. Remember that a primary goal of routing protocol design is that they must be capable of determining loop free paths through the network. Generally, routing protocols assume that the best (or shortest) path through the network is also loop free.
Link state protocols, such as IS-IS and OSPF, rely on each router in the network to advertise the state of each of their links to every other router within the local routing domain. The result is a complete network topology map, called a shortest path tree, compiled by each router in the network. As a router receives an advertisement, it will store this information in a local database, typically referred to as the link state database, and pass the information on to each of its adjacent peers. This information is not processed or manipulated in any way before it is passed on to the router's adjacent peers. The link state information is flooded through the routing domain unchanged, just as the originating router advertises it.
As each router builds a complete database of the link state information as advertised by every other router within the network, it uses an algorithm, called the shortest path first algorithm, to build a tree with itself as the center of that tree. The shortest path to each reachable destination within the network is found by traversing the tree. The most common shortest path first algorithm is the Dijkstra algorithm.
Routers running distance vector algorithms advertise the vector (path) and distance (metric) for each destination reachable within the network to adjacent (directly connected) peers. This information is placed in a local database as it is received, and some algorithm is used to determine which path is the best path to each reachable destination. Once the best path is determined, these best paths are advertised to each directly connected adjacent router.
Two common algorithms used for determining the best path are Bellman-Ford, which is used by the Routing Information Protocol (RIP and RIPv2), and the Diffusing Update Algorithm (DUAL), used by the Enhanced Interior Gateway Protocol (EIGRP).
A path vector protocol does not rely on the cost of reaching a given destination to determine whether each path available is loop free or not. Instead, path vector protocols rely on analysis of the path to reach the destination to learn if it is loop free or not. Figure 1-2 illustrates this concept.
Figure 1-2: Simple illustration of path vector protocol operation
A path vector protocol guarantees loop free paths through the network by recording each hop the routing advertisement traverses through the network. In this case, router A advertises reachability to the 10.1.1.0/24 network to router B. When router B receives this information, it adds itself to the path, and advertises it to router C. Router C adds itself to the path, and advertises to router D that the 10.1.1.0/24 network is reachable in this direction.
Router D receives the route advertisement and adds itself to the path as well. However, when router D attempts to advertise that it can reach 10.1.1.0/24 to router A, router A will reject the advertisement, since the associated path vector contained in the advertisement indicates that router A is already in the path. When router D attempts to advertise reachability for 10.1.1.0/24 to router B, router B also rejects it, since router B is also already in the path. Any time a router receives an advertisement in which it is already part of the path, the advertisement is rejected, since accepting the path would effectively result in a routing information loop.