Routing (original) (raw)

Last Updated : 21 Jan, 2026

Network routing is the process of selecting the best path for data to travel across one or more networks. It plays a vital role in the internet by ensuring that data packets reach their correct destination efficiently.

Router

A router is a networking device that controls how data moves between different networks by checking destination IP addresses and choosing the best path.

Routing of a data packet is done by analyzing the destination IP Address of the packet. Look at the below image:

ip_routing

Note: There are limits to how many hop counts a packet can do if it is exceeded, the packet is considered to be lost.

Different Types of Routing

Routing is typically of 3 types, each serving its purpose and offering different functionalities.

1. Static Routing

Static routing is a non-adaptive routing method where routes are configured manually by the network administrator. It provides complete control over routing decisions but is best suited for small networks.

2. Dynamic Routing

Dynamic routing is an automatic and adaptive routing method where routers choose paths using algorithms. It is widely used in modern networks due to its flexibility.

3. Default Routing

Default routing sends packets to a predefined gateway when no specific route is available. It is commonly used in networks with a single exit point.

Working Principle of Routing

Routing works by finding the shortest path from the source node to the destination node across a network. Here's the step-by-step working of routing:

**Step 1: Communication Start - A device (client or server) starts communication using the HTTP protocol.

**Step 2: Data Packets: The data is broken into small packets. Each packet is tagged with the destination IP address.

**Step 3: Routing Table - Routers use a routing table to find the best and shortest path to the destination.

**Step 4: Hopping - Packets travel through multiple routers (hops) to reach the destination. There is a limit on the number of hops; if exceeded, the packet is dropped and retransmitted.

**Step 5: Destination - Packets reach the destination, are reassembled, and checked for errors.

routing_working_example

In the above image, we have 3 major components

The shortest path is highlighted in red, the path with the least hop count. As we can see, there are multiple paths from source to node but if all the appropriate metrics are satisfied, the data packets will be transmitted through the shortest path (highlighted in red).

Main Routing Protocols

Different Routing Metrics

The purpose of routing protocols is to learn about all the available paths to route data packets, build routing tables, and make routing decisions based on specified metrics. There are two primary types of routing protocols rest of them ideate from these two only.

1. Distance Vector Routing

In this type of routing protocol, all the nodes that are a part of the network advertise their routing table to their adjacent nodes (nodes that are directly connected) at regular intervals. With each router getting updated at regular intervals, it may take time for all the nodes to have the same accurate network view.

Link State Routing is a type of dynamic routing protocol where routers send updates only when there is a change in the network, saving bandwidth.
Routers share information about links such as cost and hop count to find the best path.

The cost between nodes is measured using different routing metrics.

Advantages of Routing

**Disadvantages of Routing