# Protocolli e architetture di routing/A4/en

 Il titolo di questa pagina non è corretto per via delle caratteristiche del software MediaWiki. Il titolo corretto è A4. The Link State algorithm.
   [[{{#ifcategory:Traduzioni|Protocolli e architetture di routing/en|Protocolli e architetture di routing/A4|Protocolli e architetture di routing/en}}#Forwarding and routing|{{#ifcategory:Traduzioni|Protocolli e architetture di routing|Protocolli e architetture di routing/A4|Protocolli e architetture di routing/en}} (Forwarding and routing)]] [[{{#ifcategory:Traduzioni|Protocolli e architetture di routing|Protocolli e architetture di routing/A4|Protocolli e architetture di routing/en}}/A3{{#ifcategory:Traduzioni|/en||Protocolli e architetture di routing/en}}|A3. The Distance Vector algorithm]] [[{{#ifcategory:Traduzioni|Protocolli e architetture di routing|Protocolli e architetture di routing/A4|Protocolli e architetture di routing/en}}/A5{{#ifcategory:Traduzioni|/en||Protocolli e architetture di routing/en}}|A5. Hierarchical routing]]

120-121 The Link State (LS) algorithm is based on distribution of information about the neighborhood of the router over the whole network. Each node can create the map of the network (the same for all nodes), from which the routing table has to be obtained.

## 122 Components

### 123 Neighbor Greetings

• sends Neighbor Greetings to report its existence to its neighbors;
• receives Neighbor Greetings to learn which are its neighbors and the costs to reach them.

Neighbor Greetings implement fault detection based on a maximum number of consecutive Neighbor Greetings not received:

• fast: Neighbor Greetings can be sent with a high frequency (e.g. every 2 seconds) to recognize variations on adjacencies in a very short time:
• once they are received, they are not propagated but stop on the first hop → they do not saturate the network;
• they are packets of small size because they do not include information about nodes other than the generating node;
• they require a low overhead for routers, which are not forced to compute again their routing table whenever they receive one of them;
• reliable: it does not rely on the 'link-up' signal, unavailable in presence of hubs.

124 Each router generates a LS, which is a set of adjacency-cost pairs:

• adjacency: all the neighbors of the generating node;
• cost: the cost of the link between the generating router and its neighbor.

125 Each node stores all the LSs coming from all nodes in the network into the Link State Database, then it scans the list of all adjacencies and builds a graph by merging nodes (routers) with edges (links) in order to build the map of the network.

133-134 LS generation is mainly event-based: a LS is generated following a change in the local topology (= in the neighborhood of the router):

• the router has got a new neighbor;
• the cost to reach a neighbor has changed;
• the router has lost its connectivity to a neighbor previously reachable.

Event-based generation:

• allows a better utilization of the network: it does not consume bandwidth;
• it requires the 'hello' component, based on Neighbor Greetings, as the router can no longer use the periodic generation for detecting faults toward its neighbors.

In addition, routers implement also a periodic generation, with a very low frequency (in the order of tens of minutes):

• this increases reliability: if a LS for some reason goes lost, it can be sent again without having to wait for the next event;
• this allows to include an 'age' field: the entry related to a disappeared destination remains in the routing table and packets keep being sent to that destination until the piece of information, if not refreshed, ages enough that it can be deleted.

### Flooding algorithm

126 Each LS must be sent in 'broadcast' to all the routers in the network, which must receive it unchanged → real protocols implement a sort of selective flooding, representing the only way to reach all routers with the same data and with minimum overhead. Broadcast is limited only to LSs, to avoid saturating the network.

124 LS propagation takes place at a high speed: unlike DVs, each router can immediately propagate the received LS and in a later time process it locally.

135 Real protocols implement a reliable mechanism for LS propagation: every LS must be confirmed 'hop by hop' by an acknowledgment, because the router must be sure that the LS sent to its neighbors has been received, also considering that LSs are generated with a low frequency.

### Dijkstra's algorithm

127 After building the map of the network from its adjacency lists, each router is able to compute the spanning tree of the graph, that is the tree with least-cost paths having the node as a root, thanks to the Dijkstra algorithm: on every iteration all the links are considered connecting nodes already selected with nodes not yet selected, and the closest adjacent node is selected.

131 All nodes have the same Link State Database, but each node has a different routing tree to the destinations, because the obtained spanning tree changes as the chosen node as a root changes:

• better distribution of the traffic: reasonably there are no unused links (unlike Spanning Tree Protocol);
• obviously the routing tree must be consistent among the various nodes.

Bringing up adjacencies is required to synchronize Link State Databases of routers when a new adjacency is detected:

• 136 a new node connects to the network: the adjacent node communicates to it all the LSs related to the network, to populate its Link State Database from which it will be able to compute its routing table;
• 137 two partitioned subnetworks (e.g. due to a failure) are re-connected together: each of the two nodes at the link endpoints communicates to the other node all the LSs related to its subnetwork.
138 Procedure
1. a new adjacency is detected by the 'hello' protocol, which keeps adjacencies under control;
2. synchronization is a point-to-point process, that is it affects only the two routers at the endpoints of the new link;
3. the LSs which had previously been unknown are sent to other nodes in the network in flooding.

139 The LS algorithms models the network as a set of point-to-point links → it suffers in presence of broadcast[1] data-link-layer networks (such as Ethernet), where any entity has direct access to any other entity on the same data link (shared bus), hence creating a full-mesh set of adjacencies ($N$ nodes → $\tfrac{N \left( N-1 \right)}{2}$ point-to-point links).

140-141 The high number of adjacencies has a severe impact on the LS algorithm:

• 132-145 computation problems: the convergence of the Dijkstra's algorithm depends on the number of links ($L \cdot \log{N}$), but the number of links explodes on broadcast networks;
• unnecessary overhead when propagating LSs: whenever a router needs to send its LS on the broadcast network, it has to generate $N-1$ LSs, one for every neighbor, even if it would be enough to send it only once over the shared channel to reach all its neighbors, then each neighbor will in turn propagate multiple times the received LS ($\sim N^2$);
• unnecessary overhead when bringing up adjacencies: whenever a new router is added to the broadcast network, it has to start $N-1$ bring-up phases, one for every neighbor, even if it would be enough to re-align the database just with one of them.

142 The solution is to transform the broadcast topology in a star topology, by adding a pseudo-node (NET): the network is considered an active component that will start advertising its adjacencies, becoming the center of a virtual star topology:

• one of the routers is 'promoted' which will be in charge of sending also those additional LSs on behalf of the broadcast network;
• all the other routers advertise an adjacency to that node only.

143-144 The virtual star topology is valid only for LS propagation and adjacency bring-up, while normal data traffic still uses the real broadcast topology:

• LS propagation: the generating node sends a LS to the pseudo-node, which sends it to the other nodes ($\sim N$);
• adjacency bring-up: the new node activates a bring-up phase only with the pseudo-node.