A2.3.3 — Packet Switching
What is Packet Switching?
A method of sending data across a network by breaking it into small segments called packets. Each packet is sent independently and may take a different route to the destination. Where they are reassembled into the original data.
- Encapsulation: The process of adding protocol information (headers) to data before transmission.
- Decapsulation: The reverse. Removing protocol information when the data arrives at its destination and rebuilding the original message.
- Packet: Contains a payload (actual data) and a header (metadata: source address, destination address, sequence number, error detection codes).
- Routing table: A data file in routers containing rules to determine the best path for forwarding a packet to its destination.
Packet Switching Steps
1
Data segmentation: The data is broken into packets. Each packet contains part of the data plus header information.
2
Encapsulation: Each packet is given a header with routing info — source, destination, sequence number, error-checking code.
3
Independent transmission: Packets are sent individually across the network. They may take different routes depending on current network conditions.
4
Routing: Routers along the path examine each packet's destination IP and consult their routing table to determine the best next hop.
5
Arrival: Packets arrive at the destination — possibly out of order and via different paths.
6
Decapsulation and reassembly: The destination uses sequence numbers in the headers to reassemble packets in the correct order. Missing or damaged packets can be requested again.
Why Packet Switching good
- Flexibility: Each packet can take the most efficient route available at that moment, adapts to congestion and link failures automatically.
- Resilience: If one path fails, packets are rerouted. The network continues even if parts fail.
- Efficient use of bandwidth: Multiple packets from different sources share the same links, maximising utilisation.
- Scalability: Works across the entire internet.
Role of Switches and Routers
| Device | Operates at | Uses | Role in packet switching |
|---|---|---|---|
| Switch | LAN (local network) | MAC addresses | Forwards frames to the correct device within the same LAN. Maintains a MAC address table. Reduces congestion within local segments. |
| Router | Between networks (WAN) | IP addresses | Forwards packets between different networks. Consults routing table to determine the best next hop. Enables global internet connectivity. |
Summary:
- Encapsulation = adding headers. Decapsulation = removing headers. These happen at every layer.
- Sequence numbers in headers are what allow out-of-order packets to be reassembled correctly.
- Switch = MAC addresses, within a LAN. Router = IP addresses, between networks. This distinction is tested constantly.
- The internet is drawn as a cloud because you genuinely cannot know what path a packet takes.