A Hub is the simplest network device. It receives a signal on one port and broadcasts it out ALL other ports. Every device connected to the hub sees every frame. Hubs are "dumb" devices that operate at the Physical Layer. They create a single collision domain and are obsolete in modern networks.
A Switch is an intelligent device that learns the MAC addresses of connected devices and forwards frames only to the specific port where the destination device is connected. It maintains a MAC Address Table mapping MAC addresses to ports. Each port is its own collision domain, dramatically reducing collisions. Switches are the backbone of modern LANs.
A Router connects different networks (LANs, WANs) and forwards packets based on IP addresses. It maintains a Routing Table and uses routing algorithms (RIP, OSPF, BGP) to determine the best path. Routers create separate broadcast domains, preventing broadcast storms from propagating across networks.
| Device | OSI Layer | Addresses Used | Intelligence |
|---|---|---|---|
| Hub | Layer 1 | None | Broadcasts everything |
| Switch | Layer 2 | MAC Address | Forwards to specific port |
| Router | Layer 3 | IP Address | Routes between networks |