What is the difference between a hub, a switch and a router?
Three devices operating at different layers, and the difference is how intelligently they forward traffic.
- Hub — Layer 1. Repeats every incoming signal out of every other port with no intelligence. Every device sees all traffic, collisions are frequent, and bandwidth is shared. Hubs are obsolete and should never appear in a modern network; they are asked about to test whether you understand why switches replaced them.
- Switch — Layer 2. Learns which MAC address is on which port and forwards frames only to the correct destination port. This eliminates collisions, gives each port full bandwidth, and is the standard building block of a local network. Managed switches add VLANs, which segment one physical switch into separate logical networks, plus port security, link aggregation, and monitoring.
- Router — Layer 3. Connects different networks and forwards packets between them based on IP addresses and a routing table. It is the boundary of a broadcast domain, and it is where NAT, firewalling, and DHCP services usually live in smaller networks.
The simple distinction to state: a switch moves traffic within a network; a router moves traffic between networks.
Note: A Layer 3 switch blurs the line — it switches at wire speed and also routes between VLANs, which is how routing is typically done inside a modern campus network rather than sending everything through a separate router.





