Both Hubs and Switches are used to connect multiple devices in a local area network (LAN), but they handle data very differently. Today, Hubs are entirely obsolete.
The Hub (Layer 1)
A Hub is a "dumb" device. It operates at the Physical layer. When it receives a data signal on one port, it blindly copies and repeats that electrical signal out of every other port.
- Security: Poor. Any device connected to the hub can "sniff" traffic meant for other devices.
- Performance: Poor. Because it broadcasts everything, devices frequently talk over each other, causing collisions. Only one device can transmit successfully at a time (Half-Duplex).
The Switch (Layer 2)
A Switch is intelligent. It learns the MAC addresses of the devices connected to it by analyzing incoming traffic.
- Targeted Delivery: When a switch receives data, it looks at the destination MAC address and forwards the data only out of the specific port where that device lives.
- Performance: Excellent. Multiple devices can send and receive data simultaneously at full speed without causing collisions (Full-Duplex).