Network Basics: Hubs and Switches Demystified

Both hubs and switches let you connect multiple computers to a twisted-pair network. Switches are more efficient than hubs, but not just because they’re faster. If you really want to know, here’s the actual difference between a hub and a switch:

  • In a hub, every packet that arrives at the hub on any of its ports is automatically sent out on every other port. The hub has to do this because it’s a Physical layer device, so it has no way to keep track of which computer is connected to each port.

    For example, suppose that John’s computer is connected to port 1 on an 8-port hub, and Andrea’s computer is connected to port 5. If John’s computer sends a packet of information to Andrea’s computer, the hub receives the packet on port 1 and then sends it out on ports 2–8.

    All the computers connected to the hub get to see the packet so that they can determine whether the packet was intended for them.

  • A switch is a Data Link layer device, which means it’s able to look into the packets that pass through it to examine a critical piece of Data Link layer information: the MAC address. With this information in hand, a switch can keep track of which computer is connected to each of its ports.

    So if John’s computer on port 1 sends a packet to Andrea’s computer on port 5, the switch receives the packet on port 1 and then sends the packet out on port 5 only. This process is not only faster, but also improves the security of the system because other computers don’t see packets that aren’t meant for them.