Packet switching is one of the switching techniques that can be used to route the data from source to destination in a switched network. A switched network uses switches to connect multiple devices to form a large network.
In a switched network, there can be numerous paths from source to destination. The switching technique identifies the best path among these multiple paths. In this section, we will discuss the packet switching technique and its types along with its advantages.
Content: Packet Switching
Why Packet Switching?
The circuit switching technology was introduced to handle voice transmission. In circuit switching, when the source and destination communicate, the resources within the network are entirely dedicated to that communication until the communication gets completed.
In circuit-switching, the connection established between the source and destination can be utilized up to the maximum as most of the time either source or destination is talking. Later the circuit switching technology was also used for data transmission but there were two limitations.
- In data connection, most of the time the communication line is idle. For example, you just simply logged into the database server from your personal computer. This will establish a dedicated connection between your computer and database server but neither your computer nor the database server is sending data or receiving data this will leave the communication line idle. Thus, here the circuit switching approach is inefficient.
- The established communication line in the circuit switching approach provides a constant data transmission rate. What if the source and destination computers have different data rates? So, here circuit communication approach limits the capability of the network in interconnecting host computers and workstations with different data rates.
What is Packet Switching?
In the packet switching technique, when a source computer wants to send some message to the destination computer, the message is divided into multiple packets usually termed a datagram. The packets are then routed over the switched network to reach the destination.
The network layer receives the data to be transmitted from the upper layer breaks the data into small packets. These packets are sent one by one from the source computer over the network and even the destination computer receives these packets one by one. The destination computer waits till it receives all the packets from the same message.
Once all the packets have arrived at the destination computer, it is the responsibility of the destination computer’s network layer to reassemble all the data packets and deliver them to the upper layer.
The size of the forwarded packets depends on the physical network the packet has to travel to reach the destination. In the Internet today, the network layer uses the packet switching mechanism to route the data from source to destination.
Earlier this packet switching mechanism was connectionless where the packets belonging to the same message may follow different routes to reach the destination. But recently it has changed to a connection-oriented service which means all the packets of the same message must travel the same route.
If we classify the packet switching mechanism, we can categorize it into two different services connectionless service (datagram) and connection-oriented service (virtual circuit).
1. Connectionless Service (Datagram)
In the connectionless service, no prior connection is established before transmitting the packets. The network layer handles each packet as a different entity, there is no relationship between the packets even if they belong to the same message. That means packets are routed depending upon the information present in their header.
The header of each packet contains the IP address of the source computer to which the packet belongs and the IP address of the destination computer to which the packet is destined. At each switch, the destination IP address in the packet’s header is used to identify the physical address of the next hop in the network. On the other hand, the source IP address in the packet’s header is used to send an error message in case the packet is discarded.
The packets from the same message may follow a different route in the packet switch network. A packet of a message in the packet-switched network can be followed by the packet from the same or different message. A packet of a message can be followed by packets from the same source computer or a different computer.
2. Connection-Oriented Service (Virtual Circuit)
In a connection-oriented service, a virtual connection is set between the two communicating nodes and this connection determines the path for the packet. Here the packet belonging to the same message are related to each other.
In a connection-oriented service, the packet header contains one more piece of information along with the source and destination IP address i.e., the flow label (virtual circuit identifier). In our previous contents IP over ATM, we have discussed the virtual circuit identifier in brief.
The flow label defines the virtual path the packet has to follow through the Internet. All the packets from the same message must have the same flow label in their header. Now if the flow label is enough to define the path, then what is the use of source IP address and destination IP address in the packet’s header.
Actually, some part of the Internet still uses the connectionless service that makes use of source and destination IP address to route the packet. And even the protocols designed for the network layer uses these addresses so it will require some time to modify the protocols.
- Packet switching is fault-tolerant when compared to circuit switching. As if in circuit switching, a switch in the network fails all the circuits using that switch get terminated and fail to establish a connection. However, in packet switching, if a switch fails the packets are routed through the other switches in the network.
- In packet switching data conversion is possible. So, two nodes with different data rates in a packet-switched network can exchange packets.
- If a packet-switched network implements Quality of Service (QoS) then it can provide priority to certain types of packets. If a node in a packet-switched network has several packets lined up for transmission, it will transmit packets with higher priority first.
- The packet-switched network welcomes the packets from the node even if the network is busy. Though there is a delay in the delivery of the packet.
- In packet switching the resources are allotted on demand and there is no dedicated communication line between two nodes.
- The packet-switched network is best for data communication.
So, this is all about the packet switching technique which divides the message into small packets. This technique makes dynamic use of the available bandwidth.