1. Overview
In this tutorial, we’ll discuss routing, forwarding, and switching with examples.
Furthermore, we’ll present the core differences between them.
2. Networking Protocols
Let’s start the discussion with a quick look at the basics of networking protocols. A networking protocol is a set of instructions that computer systems use in communication. Most computer systems today rely on one of the protocols: Ethernet, TCP/IP, or Fibre Channel (FC).
Ethernet is a protocol that uses cables to connect various networking devices. TCP/IP is used to create computer networks that rely on wireless connections. We make use of fiber channels to move large amounts of data between computer systems.
When transmitting data from a sender to a receiver, we encounter networking terms like routing, forwarding, and switching. Each plays a critical role in end to end delivery of data. In short, routing is the process of moving data between two devices. Forwarding is the process of collecting data from one device and sending it to another device. Switching involves collecting data from one device and sending it to multiple devices based on the MAC address of the packets. Let’s discuss them in detail with examples.
3. Routing
Routing is the process of moving data from one device to another device. In most cases, routing is performed by a networking device called a router. Additionally, a router can forward two or more connections to other networks. Furthermore, we can use routers to create and manage networks. They’re responsible for moving data from one device to another within networks. Additionally, in some cases, it’s also possible to transmit data in different networks using routers:
In the OSI model, the network layer is responsible for performing routing. Among all the available paths, the network layer chooses the optimal or shortest path from sender to receiver. The routing process uses routing algorithms in order to calculate the optimal paths.
We can classify routing into three categories: static, default, and dynamic. Static routing is a nonadaptive type where the administrator adds and defines the route the data needs to follow in order to reach the destination from the source. In default routing, all the packet takes a predefined default path. It’s helpful in bulk data transmission and networks with a single exit point. Finally, dynamic routing, also known as adaptive routing, uses dynamic protocols to find new routes to reach the receiver.
Routing is sometimes referred to as forwarding, but it’s important to note that routing is a different process from forwarding. When routing data, the router takes care of moving the data from one device to another device. When forwarding data, a device collects data from one device and sends it to another. Let’s discuss the forwarding process in detail.
4. Forwarding
Forwarding is the process of collecting data from one device and sending it to another device. This process differs from routing because it doesn’t manage moving data from one device to another. Unlike the routing process, forwarding performs some actions and simply forwards the packets which arrive in intermediate routers. It’s not responsible for deciding the path. In the forwarding process, we only forward the packets to another attached network:
Both routing and forwarding are performed by the network layer. The device that collects data and sends it to another device is known as the forwarding device. Some popular forwarding devices include routers, switches, and hubs.
Let’s talk about some popular forwarding methods used in networking. The next hop method is the most straightforward technique, which sends the packets received in a router to the next gateway in the direction of the destination. In the network-specific method, the entries in the routing table consist of destination networks connected with routers. Finally, in the case of the host-specific method, the routing table contains information about all the destination hosts in the destination network.
5. Switching
Switching is the process of collecting data coming from one port and sending it to another port toward the destination. Switching can be connectionless as well as connection-oriented. In connectionless switching, connection establishment using handshaking is not required. The packets received in a port are sent based on the forwarding table. On the other hand, a connection-oriented switching process uses a predefined circuit along with intermediate nodes ID between the sender and receiver.
We can classify switching techniques into three categories: circuit, message, and packet switching. In circuit switching, we need to establish a circuit before sending the data. In the case of message switching, the whole received data is treated as a message and sent to the intermediate switching devices. Finally, packet switching breaks the data into small chunks called packets. The packets are transmitted independently.
The devices used in the switching process are known as switching devices. Examples of switching devices are hubs and routers. Let’s take a look at an example of switching:
6. Differences
Routing, forwarding, and switching are all used to move data between devices. Routing is the process of moving data between two devices. Forwarding is the process of collecting data from one device and sending it to another device. Finally, switching is the process of collecting data from one device and sending it to another device along with a path.
Now let’s talk about the core differences between routing, forwarding, and switching:
Routing
Forwarding
Switching
Process of moving data from one device to another device
Process of collecting data from one device and sending it to another device
Process of switching data packets between devices on the same network
Operates on the network layer
Operates on the network layer
Operates on the data link layer
Works based on IP address
Checks the forwarding table, and forward the packets accordingly
Works based on MAC address
Follows different protocols such as Routing Information Protocol (RIP) for routing
Follows different protocols such as UDP Encapsulating Security Payloads (UDP ESP)
Follows different protocols such as Spanning Tree Protocol (STP)
7. Conclusion
In this tutorial, we discussed routing, forwarding, and switching with examples.
We also presented the core differences between them.