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.
- Routing determines the path IP packets follow from source to destination.
- It is used in packet-switched networks like the Internet.
- Different routing methods are used to optimize speed, reliability, and performance.
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.
- Forwards data packets between networks
- Works at Layer 3 (Network Layer) of the OSI model
- Selects the best route for data transfer
Routing of a data packet is done by analyzing the destination IP Address of the packet. Look at the below image:

- The Source Node (Sender) sends the data packet on the network, embedding the IP in the header of the data packet.
- The nearest router receives the data packet, and based on some metrics, further routes the data packet to other routers.
- Step 2 occurs recursively till the data packet reaches its intended destination.
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.
- Routes are added manually
- Full control over packet routing
- Simple but hard to manage in large 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.
- Routes update automatically
- Adapts to network changes
- Suitable for large networks
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.
- Used when no route is found
- Simple and efficient setup
- Default route: 0.0.0.0/0
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.

In the above image, we have 3 major components
- Sender
- Receiver
- Routers
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
- RIP (Routing Information Protocol): It is a distance-vector protocol that uses hop count as a metric.
- OSPF (Open Shortest Path First): OSPF is a link-state protocol that finds the shortest path using the Dijkstra algorithm.
- EIGRP (Enhanced Interior Gateway Routing Protocol): It is a hybrid protocol that combines features of distance-vector and link-state.
- BGP (Border Gateway Protocol): It is a path-vector protocol that is used for routing between different autonomous systems on the internet.
- IS-IS (Intermediate System to Intermediate System): It is a link-state protocol that is primarily used in large networks like ISPs.
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.
- Uses fixed length sub-net, not suitable for scaling.
- Algorithm used: Bellman Ford Algorithm to find the shortest path.
2. Link State Routing
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.
- It uses Variable Length Subnet Mask (VLSM) for better and scalable addressing.
- It uses Dijkstra’s Algorithm to calculate the shortest path.
The cost between nodes is measured using different routing metrics.
- Hop Count: The number of nodes a data packet passes through to reach its destination. Fewer hops mean a shorter and faster path.
- Bandwidth Consumption: Routing selects paths that use network bandwidth efficiently to avoid congestion.
- Delay: The time taken by a data packet to travel from source to destination. Routing aims to reduce delays.
- Load: Refers to how busy a network path is. Packets are sent through less busy paths for faster delivery.
- Reliability: Routing chooses stable and available paths to ensure data reaches its destination safely.
Advantages of Routing
- Routing: Helps send data efficiently by choosing the best path.
- Automated Routing: Uses algorithms to reduce manual work but gives less direct control.
- Manual Routing: Provides better control but requires more effort to manage.
- Scalable Routing: Works well for large networks and supports load balancing to reduce traffic and data loss.
Disadvantages of Routing
- Static Routing: Suitable only for small networks; difficult to manage and less secure in large networks.
- Dynamic Routing: Offers less manual control and uses more bandwidth and system resources.
- Default Routing: Easy to use but can cause issues if the default path is not properly configured.