Packet switching is the way networks (including the internet) move packets from sender to receiver. The five stages every time:
- The sender's device breaks the data into packets and adds a header and trailer to each.
- Each packet is assigned a destination IP address.
- Packets are handed to a router. The router consults its routing table and forwards each packet to a nearby router that is closer to the destination.
- Packets may take different paths through the network. If one route is congested, a router can send the next packet down a less busy route.
- Packets arrive at the destination, possibly out of order. The receiver uses the packet numbers to reassemble them, checks for missing or corrupted packets, and requests any missing packets to be resent.
Advantages of packet switching
- Routes around congestion. If one path is busy, packets can take a different one.
- Resilient to packet loss. If a packet is corrupted or lost, only that one packet has to be resent, not the whole message.
- Efficient use of the network. Many transmissions share the same links because packets are interleaved, rather than each transmission having its own dedicated wire.
- Harder to eavesdrop on a whole message because each packet may go a different way and an attacker would have to intercept all of them.