- Link-state routing protocol
A link-state routing protocol is one of the two main classes of
routing protocol s used in packet-switched networks forcomputer communication s. Examples of link-state routing protocols includeOSPF andIS-IS .The link-state protocol is performed by every "switching node" in the network (i.e. nodes which are prepared to forward packets; in the
Internet , these are calledrouter s). The basic concept of link-state routing is that every node constructs a "map" of the connectivity of the network, in the form of a graph showing which nodes are connected to which other nodes.The link-state routing requires each switching node in the network to send its information about its neighbors to the entire internetwork.
Each node then independently calculates the best "next hop" from it for every possible destination in the network. (It does this using only its local copy of the map, and without communicating in any other way with any other node.) The collection of best next hops forms the
routing table for the node.This contrasts with
distance-vector routing protocol s, which work by having each node share its routing table with its neighbors. In a link-state protocol, the only information passed between the nodes is information used to construct the connectivity maps.History
The first Link-state routing was invented in
1978 by John McQuillan (then atBolt, Beranek and Newman ) as a mechanism that would calculate routes more quickly when network conditions changed, and thus lead to more stable routing.Later work at BBN showed how to use the link-state technique in a hierarchical system, i.e. one in which the network was divided into areas, so that each switching node does not need a map of the entire network, only the area(s) in which it is included.
The technique was later adapted for use in the contemporary link-state routing protocols
IS-IS andOSPF . Cisco'sEIGRP shares characteristics with Link-state routing, specifically it doesn't flood its entire routing table with to its neighbors, but is built on the IGRPdistance-vector routing protocol . This functionality is referred to as "hybrid" in Cisco and third party literature.More recently, this hierarchical technique was applied to
wireless mesh network s using theoptimized link state routing protocol .Where a connection can have varying quality, the quality of a connection can be used to select better connections. This is used in some routing protocols that use radios.Distributing maps
This description covers only the simplest configuration; i.e. one with no areas, so that all nodes do have a map of the entire network. The hierarchical case is somewhat more complex; see the various protocol specifications.
As previously mentioned, the first main stage in the link-state algorithm is to give a map of the network to every node. This is done with several simple subsidiary steps.
Determining the neighbors of each node
First, each node needs to determine what other ports it is connected to, over fully-working links; it does this using a simple "reachability protocol" which it runs separately with each of its directly-connected neighbors.
Distributing the information for the map
Next, each node periodically makes up a short message, the "link-state advertisement", which:
* Identifies the node which is producing it.
* Identifies all the other nodes to which it is directly connected.
* Includes a "sequence number", which increases every time the source node makes up a new version of the message.This message is then "flooded" throughout the network. As a necessary precursor, each node in the network remembers, for every other node in the network, the sequence number of the last link-state message which it received from that node. With that in hand, the method used is simple.
Starting with the node which originally produced the message, it sends a copy to all of its neighbors. When a link-state advertisement is received at a node, the node looks up the sequence number it has stored for the source of that link-state message. If this message is newer (i.e. has a higher sequence number), it is saved, and a copy is sent in turn to each of that node's neighbors.
This procedure rapidly gets a copy of the latest version of each node's link-state advertisement to every node in the network.
Creating the map
Finally, with the complete set of link-state advertisements (one from each node in the network) in hand, it is obviously easy to produce the graph for the map of the network.
The algorithm simply iterates over the collection of link-state advertisements; for each one, it makes links on the map of the network, from the node which sent that message, to all the nodes which that message indicates are neighbors of the sending node.
No link is considered to have been correctly reported unless the two ends agree; i.e. if one node reports that it is connected to another, but the other node does not report that it is connected to the first, there is a problem, and the link is not included on the map.
Notes about this stage
The link-state message giving information about the neighbors is recomputed, and then flooded throughout the network, whenever there is a change in the connectivity between the node and its neighbors, e.g. when a link fails. Any such change will be detected by the reachability protocol which each node runs with its neighbors.
Calculating the routing table
As initially mentioned, the second main stage in the link-state algorithm is to produce routing tables, by inspecting the maps. This is again done with several steps.
Calculating the shortest paths
Each node independently runs an
algorithm over the map to determine the shortest path from itself to every other node in the network; generally some variant ofDijkstra's algorithm is used.Basically, a node maintains two data structures: a tree containing nodes which are "done", and a list of "candidates". The algorithm starts with both structures empty; it then adds to the first one the node itself. The algorithm then repetitively:
* Adds to the second (candidate) list all nodes which are connected to the node just added to the tree (excepting of course any nodes which are already in either the tree or the candidate list).
* Of the nodes in the candidate list, moves to the tree (attaching it to the appropriate neighbor node already there) the one which is the closest to any of the nodes already in the tree.
* Repeat as long as there are any nodes left in the candidate list. (When there are none, all the nodes in the network will have been added to the tree.)
This procedure ends with the tree containing all the nodes in the network, with the node on which the algorithm is running as the "root" of the tree. The shortest path from that node to any other node is indicated by the list of nodes one traverses to get from the root of the tree, to the desired node in the tree.
Filling the routing table
With the shortest paths in hand, filling in the routing table is trivial.
For any given destination node, the best next hop for that destination is the node which is the first step from the root node, down the branch in the shortest-path tree which leads toward the desired destination node.
To create the routing table, it is only necessary to walk the tree, remembering the identity of the node at the head of each branch, and filling in the routing table entry for each node one comes across with that identity.
In a link state algorithm, routers regularly exchange link state messages – sometimes known as HELLO PACKETS – with their neighbors. These messages are small and consume little bandwidth. Routers ‘learn’ who their neighboring routers are. Routing updates are sent to all known routers- by unicast rather than broadcast. Although the algorithm is not as straightforward as in the distance-vector case, if a router ‘knows’ its neighboring routers and then gets to learn about their neighboring routers, it will learn about the existence of all the routers.
Routing updates are sent only when there is a change in topology- except for infrequent periodic updates. Networks running link state algorithms can also be segmented into hierarchies which limit the scope of route changes. These features mean that link state algorithms scale better to larger networks.
Link state algorithms are sometimes characterized by the phrase ‘Each router tells the world about its neighbors’.
Optimizations to the algorithm
The algorithm described above was made as simple as possible, to aid in ease of understanding. In practice, there are a number of optimizations which are used.
Most importantly, whenever a change in the connectivity map happens, it is necessary to recompute the shortest-path tree, and then recreate the routing table. The BBN work discovered how to recompute only that part of the tree which could have been affected by a given change in the map.
Also, the routing table would normally be filled in as the shortest-path tree is computed, instead of making it a separate operation.
Failure modes
If all the nodes are not working from exactly the same map, "routing loops" can form. (These are situations in which, in the simplest form, two neighboring nodes each think the other is the best next hop to a given destination. Any packet headed to that destination arriving at either node will loop between the two, hence the name. Routing loops involving more than two nodes are also possible.)
The reason is fairly simple: since each node computes its shortest-path tree and its routing table without interacting in any way with any other nodes, then if two nodes start with different maps, it is easy to have scenarios in which routing loops are created.
Advantages and disadvantages of link-state routing
See Comparison of routing algorithms.
References
* John M. McQuillan, Isaac Richer and Eric C. Rosen, "ARPANet Routing Algorithm Improvements", BBN Report No. 3803, Cambridge, April 1978
* John M. McQuillan, Isaac Richer and Eric C. Rosen, "The New Routing Algorithm for the ARPANet",IEEE Trans. on Comm., 28(5), pp. 711-719, 1980
* Josh Seeger and Atul Khanna, "Reducing Routing Overhead in a Growing DDN", MILCOMM '86, IEEE, 1986
Wikimedia Foundation. 2010.