The Wayback Machine - https://web.archive.org/web/20240630002244/https://www.geeksforgeeks.org/unicast-routing-link-state-routing/
Open In App

Unicast Routing – Link State Routing

Last Updated : 13 Sep, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Prerequisite: Distance Vector Routing, Dijkstra algorithm

Unicast means the transmission from a single sender to a single receiver. It is a point-to-point communication between the sender and receiver. There are various unicast protocols such as TCP, HTTP, etc.  

  • TCP is the most commonly used unicast protocol. It is a connection-oriented protocol that relies on acknowledgment from the receiver side. 
  • HTTP stands for HyperText Transfer Protocol. It is an object-oriented protocol for communication. 
Unicast Routing

Unicast Routing

Major Protocols of Unicast Routing

  1. Distance Vector Routing: Distance-Vector routers use a distributed algorithm to compute their routing tables.
  2. Link-State Routing: Link-State routing uses link-state routers to exchange messages that allow each router to learn the entire network topology.
  3. Path-Vector Routing: It is a routing protocol that maintains the path that is updated dynamically.

Link State Routing

Link state routing is the second family of routing protocols. While distance-vector routers use a distributed algorithm to compute their routing tables, link-state routing uses link-state routers to exchange messages that allow each router to learn the entire network topology. Based on this learned topology, each router is then able to compute its routing table by using the shortest path computation. 

Link state routing is a technique in which each router shares the knowledge of its neighborhood with every other router i.e. the internet work. The three keys to understand the link state routing algorithm.

  1. Knowledge about the neighborhood: Instead of sending its routing table, a router sends the information about its neighborhood only. A router broadcast its identities and cost of the directly attached links to other routers.
  2. Flooding: Each router sends the information to every other router on the internetwork except its neighbors. This process is known as flooding. Every router that receives the packet sends the copies to all the neighbors. Finally each and every router receives a copy of the same information.
  3. Information Sharing: A router send the information to every other router only when the change occurs in the information.

Link state routing has two phase:

  1. Reliable Flooding: Initial state– Each node knows the cost of its neighbors. Final state- Each node knows the entire graph.
  2. Route Calculation: Each node uses Dijkstra’ s algorithm on the graph to calculate the optimal routes to all nodes. The link state routing algorithm is also known as Dijkstra’s algorithm which is used to find the shortest path from one node to every other node in the network.

Features of Link State Routing Protocols

  • Link State Packet: A small packet that contains routing information. 
  • Link-State Database: A collection of information gathered from the link-state packet. 
  • Shortest Path First Algorithm (Dijkstra algorithm): A calculation performed on the database results in the shortest path 
  • Routing Table: A list of known paths and interfaces. 

Calculation of Shortest Path

To find the shortest path, each node needs to run the famous Dijkstra algorithm. Let us understand how can we find the shortest path using an example.

Illustration

To understand the Dijkstra Algorithm, let’s take a graph and find the shortest path from the source to all nodes.

Note: We use a boolean array sptSet[] to represent the set of vertices included in SPT. If a value sptSet[v] is true, then vertex v is included in SPT, otherwise not. Array dist[] is used to store the shortest distance values of all vertices.

Consider the below graph and src = 0.

Shortest Path Calculation - Step 1

Shortest Path Calculation – Step 1

STEP 1: The set sptSet is initially empty and distances assigned to vertices are {0, INF, INF, INF, INF, INF, INF, INF} where INF indicates infinite. Now pick the vertex with a minimum distance value. The vertex 0 is picked and included in sptSet. So sptSet becomes {0}. After including 0 to sptSet, update the distance values of its adjacent vertices. Adjacent vertices of 0 are 1 and 7. The distance values of 1 and 7 are updated as 4 and 8. 

The following subgraph shows vertices and their distance values. Vertices included in SPT are included in GREEN color.

Shortest Path Calculation - Step 2

Shortest Path Calculation – Step 2

STEP 2: Pick the vertex with minimum distance value and not already included in SPT (not in sptSET). The vertex 1 is picked and added to sptSet. So sptSet now becomes {0, 1}. Update the distance values of adjacent vertices of 1. The distance value of vertex 2 becomes 12.

Shortest Path Calculation - Step 3

Shortest Path Calculation – Step 3

STEP 3: Pick the vertex with minimum distance value and not already included in SPT (not in sptSET). Vertex 7 is picked. So sptSet now becomes {0, 1, 7}. Update the distance values of adjacent vertices of 7. The distance value of vertex 6 and 8 becomes finite (15 and 9 respectively). 

Shortest Path Calculation - Step 4

Shortest Path Calculation – Step 4

STEP 4: Pick the vertex with minimum distance value and not already included in SPT (not in sptSET). Vertex 6 is picked. So sptSet now becomes {0, 1, 7, 6}. Update the distance values of adjacent vertices of 6. The distance value of vertex 5 and 8 are updated.

Shortest Path Calculation - Step 5

Shortest Path Calculation – Step 5

We repeat the above steps until sptSet includes all vertices of the given graph. Finally, we get the following Shortest Path Tree (SPT).

Shortest Path Calculation - Step 6

Shortest Path Calculation – Step 6

Characteristics of Link State Protocol

  • It requires a large amount of memory. 
  • Shortest path computations require many CPU circles. 
  • If a network uses little bandwidth; it quickly reacts to topology changes 
  • All items in the database must be sent to neighbors to form link-state packets. 
  • All neighbors must be trusted in the topology. 
  • Authentication mechanisms can be used to avoid undesired adjacency and problems. 
  • No split horizon techniques are possible in the link-state routing.
  • OSPF Protocol 

Protocols of Link State Routing

  1. Open Shortest Path First (OSPF)
  2. Intermediate System to Intermediate System (IS-IS)

Open Shortest Path First (OSPF): Open Shortest Path First (OSPF) is a unicast routing protocol developed by a working group of the Internet Engineering Task Force (IETF). It is an intradomain routing protocol. It is an open-source protocol. It is similar to Routing Information Protocol (RIP). OSPF is a classless routing protocol, which means that in its updates, it includes the subnet of each route it knows about, thus, enabling variable-length subnet masks. With variable-length subnet masks, an IP network can be broken into many subnets of various sizes. This provides network administrators with extra network configuration flexibility. These updates are multicasts at specific addresses (224.0.0.5 and 224.0.0.6). OSPF is implemented as a program in the network layer using the services provided by the Internet Protocol. IP datagram that carries the messages from OSPF sets the value of the protocol field to 89. OSPF is based on the SPF algorithm, which sometimes is referred to as the Dijkstra algorithm.

Intermediate System to Intermediate System (IS-IS): Intermediate System to Intermediate System is a standardized link-state protocol that was developed as the definitive routing protocol for the OSI Model. IS-IS uses System ID to identify a router on the network. IS-IS doesn’t require IP connectivity between the routers as updates are sent via CLNS instead of IP.

For more about OSPF and IS-IS, you can refer Difference between OSPF and IS-IS article.



Previous Article
Next Article

Similar Reads

Difference between Distance vector routing and Link State routing
Prerequisite – Classification of Routing Algorithms Distance Vector Routing - It is a dynamic routing algorithm in which each router computes a distance between itself and each possible destination i.e. its immediate neighbors.The router shares its knowledge about the whole network to its neighbors and accordingly updates the table based on its nei
2 min read
Optimized Link State Routing Protocol
OLSR stands for Optimized Link State Routing Protocol. In this, each node periodically floods status of its links. Each node re-broadcasts link state information received from its neighbors. Each node keeps track of link state information received from other nodes. Each node uses above information to determine next hope to each destination. It is p
6 min read
TCL script to simulate link state routing in ns2
In this article we will know how to write a TCL script for the simulation of one of the routing protocols link state routing (also called dijkstra's algorithm) using the Network Simulator. To understand more about the basics of TCL scripts you can check out this article https://www.geeksforgeeks.org/basics-of-ns2-and-otcltcl-script/. TCL script to
5 min read
How Link State Routing is Different from Others?
Answer: Link-state routing protocols maintain a complete map of network topology and calculate routes independently, while other protocols like distance vector rely on iterative updates and have limited network visibility. Link State Routing is an algorithm used to find the optimal path of data packets transmitted from a source to destinations in a
2 min read
Difference between Unicast and Broadcast
1. Unicast : Unicast is a type of information transfer and it is used when there is a participation of single sender and single recipient. So, in short, you can term it as a one-to-one mapping. For example, a device having IP address 10.1.4.0 in a network wants to send the traffic stream (data packets) to the device with IP address 20.14.4.2 in the
2 min read
Difference between Unicast and Multicast
1. Unicast : Unicast is a type of information transfer and it is used when there is a participation of single sender and single recipient. So, in short, you can term it as a one-to-one mapping. For example, a device having IP address 10.1.4.0 in a network wants to send the traffic stream (data packets) to the device with IP address 20.14.4.2 in the
2 min read
How To Identify by Examining Whether a Packet is Unicast or Multicast?
Pre-requisites: Multicasting in Computer Networks Difference between Unicast, Broadcast, and Multicast in Computer Networks In a computer network, a packet is a unit of data that is transmitted over the network from one device to another. Packets can be classified as either unicast or multicast based on the type of address used to identify the dest
4 min read
How to identify unicast ip address?
Answer: To identify the unicast IP address, first check the first part of the given IP address. If the first part of the given IP is in between the range of 192.0. 0.0 to 223.255. 255.255 then the address is unicast address. What is Unicast?When a packet is sent from one address to other single address then the process is known as unicast. In the u
1 min read
Difference between Unicast, Broadcast and Multicast in Computer Network
The cast term here signifies some data(stream of packets) is being transmitted to the recipient(s) from the client(s) side over the communication channel that helps them to communicate. Let's see some of the "cast" concepts that are prevailing in the computer networks field.  FeatureUnicastBroadcastMulticastDefinition A communication where a messag
3 min read
Difference between Classful Routing and Classless Routing
Classful Routing: Classful Routing does not import subnet mask. And in this also subnet mask is provided after the route update. In classful routing, subnet mask is same throughout, does not vary for all devices, we can see it in the given picture. In classful routing, VLSM (Variable Length Subnet Mask) is not supported and also CIDR (Classless Int
2 min read
Article Tags :