Difficulty level: • • • •
By Lindsay Bull, technical writer
When you send information from one device to another, a packet is sent from the sending device to the receiving device with the information necessary to tell it what to do. This is done utilizing a switch if you’re communicating on a LAN with another device connected to that LAN or utilizing a router otherwise. We’ll illustrate both.
Packet transfer on a LAN:
Packet transfer utilizing a router:
Now, how are these packets finding their destinations? Similar to snail mail, packets need addresses so the switches and routers moving them along know what their final destination is. These addresses along with other information are included in something referred to as a header, which is attached to the front of the packet. In this process, several types of addresses are used:
- Ethernet/MAC address
- IP address
Let’s take a deeper dive into how this moving along of packets occurs—starting with LANs:
We’ve established a switch is used when two devices are communicating on a LAN. In order for that switch to know which port should receive each packet, it needs to know which address belongs to which device connected to it. When each device was connected to the switch initially, the device had to send some type of communication to the network, which the switch observed. When the switch saw that communication, it logged that device’s address and port into a table.
Anytime a device communicates with another device on that LAN, the switch checks its table and delivers the packet to the port associated with the packet’s final destination listed in its header.
So what if a device needs to communicate with a device not on its same LAN?
This is where the router comes into play. When a device sends a communication, it knows if the final destination isn’t on its network and will address the packet to the router connected to the switch. In this instance, the packet will still pass through the switch, but this time the switch will pass the packet to the router.
Depending on how far away the destination network is, the packet will be passed from router to router. Each time the packet reaches a new router, the router will refer to the header—if the address in the header doesn’t match the local network address of the router, it will pass it up to the next router. This process will repeat until the final destination of the packet is reached.
Keep in mind, all of this is happening basically instantaneously, and most of the time, an acknowledgement of receipt is sent back to the source device. So every time you send a file to print, use the app to turn on your speakers, or even send an email, this same process occurs, connecting you to devices across the room, across the country, and even across the world.
We hope this post helped you better understand how devices are able to communicate with each other! Please leave us a comment below with any feedback or requests for future topics; we love to hear from our readers!