In a typical network application, two systems need to communicate with each other. The communication happens by exchanging messages over the network. These messages can contain any type of data such as an email message, an image or an audio/video file. However, we cannot transfer messages directly from one system to another. This is where packet switching comes into the picture.

Packet switching is the method of transferring data or packet from the source system to the destination system.

packet switching basics

But what is a packet in computing terms?

In order to transfer efficiently, a message is broken up into small chunks. These chunks are known as packets. And hence the name Packet Switching.

1 – Store-and-Forward Transmission

Though we understand that packet switching deals with the transfer of packets from source to destination, but we don’t know much about the actual operation of this whole process.

How do network packets travel from source to destination?

Packets travel through communication links and packet switches (routers and link-layer switches). You can think of communication links as highways and packet switches as intersections. A given source and destination might have several communication links and packet switches in between. And most of these packet switches use store-and-forward transmission.

Store-and-forward packet switching means that the packet switch or router must receive the entire packet and then only transmit it further. See below illustration. The first packet is stored at the router. Only when all packets arrive, they move further.

store and forward packet switching

The main advantage of store-and-forward transmission approach is high quality data packet transmission. Erroneous packets gets discarded at each hop in the network. This leads to a reduction in the number of bad packets on the network.

The seeming disadvantage of this approach is higher latency. Since every packet switch waits for the entire packet to arrive before transmitting it further, there is an increase in wait time at each step. As the number of switches increase, it can drastically increase the overall latency.

2 – Forwarding Tables

In packet switching, a router receives a packet and forwards it to another one of its attached communication link or the highway.

But how does the router determine which link or highway it should use?

Forwarding tables take care of routing a packet onto the correct link. Each router has a forwarding table that maps destination addresses to the router’s outbound links.

But what exactly are these addresses? Well, they are nothing but IP addresses. Every end system on the internet has an IP address.

When a source system sends a packet to a destination, it includes the destination’s IP address in the packet’s header. You can think of IP address as postal address. Just like the postal address, IP addresses have a hierarchical structure. For example, a postman delivering a letter to 1015 Mill Street, Greenville, South Carolina will start with the top-level hierarchy (i.e. South Carolina) and then, move lower to the city, the street and finally the particular house number.

The same is true for packet switching using forwarding tables.When a packet arrives at a router, it examines a particular portion of the destination IP address and forwards the packet to an adjacent router based on the forwarding table.

3 – Types of Packet Switching

There are two types of packet switching – connectionless and connection-oriented.

3.1 – Connectionless Packet Switching

In connectionless packet switching, every packet contains all the information such as source address, destination address. This approach is also known as datagram packet switching.

Basically, in this approach, each packet is independent. Packets belonging to the same message may travel through the network using completely different routes. The packets may also arrive at the destination out-of-order depending on latency for each packet.

connection less packet switching
Connection-less Packet Switching

In the above illustration, every packet finds its own path through the network. Since there is no guarantee of packet delivery in this approach, additional checks should be present on the end-systems to ensure that the message is complete

3.2 – Connection-oriented Packet Switching

As the name suggests, connection-oriented packet switching establishes a logical path or a virtual connection using signalling protocol. All packets will flow through the pre-decided route. A virtual circuit id is setup to facilitate the transfer of packets. We call this approach as virtual-circuit approach.

connection oriented packet switching
Connection-oriented Packet Switching

In the above illustration, every packet follows the same path through the network. We highlight it in brown colour.

There are three phases – setup, data transfer and tear-down. The address information is processed during the setup phase. Once the route is finalized, entries are made to the switching tables of every node present in the path. After the data transfer is complete, the tear-down of the connection takes place.

Conclusion

Packet switching is a fundamental concepts in computer networking. It forms a key part of how the Internet actually works. Store-and-forward transmission along with forwarding tables are the building blocks of packet switching. We have covered both of them along with illustrations.

If you have any comments or queries about this post, please mention them in the comments section below.


Saurabh Dashora

Saurabh is a Software Architect with over 12 years of experience. He has worked on large-scale distributed systems across various domains and organizations. He is also a passionate Technical Writer and loves sharing knowledge in the community.

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *