What is the difference between a hub, a switch and a router? Mention the OSI layer each works at, how each decides where to send data, and how they affect collision and broadcast domains.
Show hints
Ask what address, if any, each device looks at.
Show the explanation
Model answer.
Hub — Layer 1 (physical)
- A multi-port repeater: any bits arriving on one port are regenerated and sent out of all other ports.
- Looks at no addresses.
- All ports share one collision domain, so only one device can transmit at a time (half-duplex). Performance drops as more devices are added.
- Largely obsolete today.
Switch — Layer 2 (data link)
- Forwards frames based on destination MAC addresses.
- Learns automatically: when a frame arrives, it records the source MAC and the incoming port in its MAC address table (CAM table).
- For a known destination it sends the frame only out of the correct port. For an unknown unicast destination or a broadcast (FF:FF:FF:FF:FF:FF), it floods to all ports except the incoming one.
- Each port is its own collision domain and supports full-duplex, so collisions effectively disappear.
- All ports are still in one broadcast domain (unless VLANs are configured).
Router — Layer 3 (network)
- Forwards packets between different IP networks using a routing table (destination network → next hop / interface), choosing the longest-prefix match.
- Does not forward layer-2 broadcasts, so each interface is a separate broadcast domain.
- Decrements the IP TTL at each hop and rewrites the layer-2 header for the next link.
- Home "Wi-Fi routers" combine a router, a switch, a wireless access point, a DHCP server and NAT in one box.
Summary
| Device | Layer | Decides by | Collision domains | Broadcast domains |
|---|---|---|---|---|
| Hub | 1 | Nothing (repeats) | One for all ports | One |
| Switch | 2 | MAC address | One per port | One (per VLAN) |
| Router | 3 | IP address | One per port | One per interface |
Common follow-up: "What is a layer-3 switch?" A switch that can also route between VLANs in hardware — useful inside a campus network, while dedicated routers typically handle WAN links and richer routing features.
Original UniCircle question. Last reviewed 28 Oct 2026.
