In computer networking, two terms, routing and forwarding, are often used interchangeably. However, they refer to two different stages in the data transmission process. In order to fully understand the networking approach, it's important to understand the distinguishing factor between routing and forwarding.
Routing and forwarding are two different mechanisms that work in completely different ways. Let's dive in deeper to understand and clarify their respective functions.
Routing refers to the process of determining the optimal path from source to destination for data transmission in the computer network. Whenever an edge device needs to transmit data packets to another device located on another network or subnet, a routing phenomenon is used. This mechanism is achieved through a router.
A router is a specialized networking device that is designed to connect different networks and allow data transmission between the connected networks. They achieve this by handling routing decisions and thereby routing data packets o the optimal path calculated by them. This calculation is done through a routing table.
A routing table enables the router to forward the data packets to a port in an intelligent way after calculating the optimal path from the source to a destination IP address.
A routing table looks something like this:
Network Destination | Netmask | Gateway | Outgoing Interface | Metric |
101.25.67.0 | 255.255.255.0 | 10.0.0.2 | eth0 | 1 |
Read this, if you want to learn more about routing table and its computation.
The routing process involves analyzing the destination IP addresses of the data packets and consulting the routing table to calculate the optimal path for the data packets in transit.
Routers use various metrics like hop count, bandwidth, delay, or path cost to calculate the data packets' most feasible or optimal path. After calculating the optimal path, the router forwards the packet to the next hop along that path. This process continues until the data packet reaches its destination.
Forwarding refers to the process of actually transmitting the data packets from one network device to the next hop in their route. This route has been predetermined by the previous routers in the network.
Therefore, forwarding doesn't involve any real decision-making and is a straightforward real-time operation that occurs when data packets arrive at a router.
The forwarding process is when a data packet arrives at a router, computes its optimal route and the feasible next hop to which the packet should be sent.
As illustrated above, the data packet is forwarded from the input interface of the router to the correct outgoing interface, as per the optimal path calculated by the routing table.
The key differences between routing and forwarding can be best illustrated in tabular form as follows:
Routing | Forwarding | |
Purpose | Determining the optimal path for packets | Transmitting data packets from one interface to the other |
Decision | Involves decision making | Doesn't involve complex decisions |
Complexity | More complex | Relatively simpler |
Position | Performed at the network level | Performed at each individual router |
Free Resources