Hub vs Switch
Both connect devices; the difference fits in one sentence: a hub shouts, a switch whispers. That difference explains why modern networks are built on switches.
01Hub
A hub works at OSI Layer 1 (Physical) — it doesn't understand the incoming signal, it just copies it.
Hub
/ | \
PC1 PC2 PC3
PC1 → Hub → send to everyone (broadcast)
Its properties
- No intelligence: copies incoming data to every port
- If two devices talk at once, you get a collision
- Bandwidth is shared across all ports
- Everyone sees everyone's traffic — zero security
Every device on a hub shares one collision domain: the line is a single lane and everybody drives in it.
02Switch
A switch works at OSI Layer 2 (Data Link) — it reads and learns MAC addresses.
Switch (MAC table)
/ | \
PC1 PC2 PC3
PC1 → Switch → deliver only to PC2 (unicast)
Its properties
- Keeps a table of which MAC lives on which port
- Forwards a frame only to its destination port
- Every port is its own collision domain — no collisions
- Every port gets full bandwidth
- Traffic is only visible to the parties involved
The MAC address table
| Port | MAC address |
|---|---|
| 1 | AA:BB:CC:DD:EE:01 |
| 2 | AA:BB:CC:DD:EE:02 |
| 3 | AA:BB:CC:DD:EE:03 |
The switch learns this table by itself: it notes the source MAC of every frame arriving on a port. If it sees a destination it doesn't know yet, it briefly acts like a hub and asks everyone (flooding).
03Comparison
| Feature | Hub | Switch |
|---|---|---|
| OSI layer | Layer 1 | Layer 2 |
| Decision logic | None | MAC table |
| Forwarding | Broadcast | Unicast |
| Collisions | Yes | No |
| Bandwidth | Shared | Full per port |
| Security | None | Traffic isolated |
04Example scenario
With a hub: PC1 sends a file to PC2 → the hub copies it to PC3 and PC4 too → they discard it ("not for me"). Result: wasted traffic + a line anyone can eavesdrop.
With a switch: PC1 sends a file to PC2 → the switch checks its table → forwards only to Port 2. Result: efficient and isolated.
05Try it yourself
You don't have to read about this difference — you can watch it:
Sandbox · BuilderNetwork BuilderWire PCs to a hub, then a switch; fire the same packet and watch broadcast vs unicast play out.Open tool06Summary
- Hub = Layer 1, copies everything to everyone
- Switch = Layer 2, delivers only to the target via its MAC table
- A switch gives every port its own collision domain
- Hubs are gone from modern networks; they survive as a teaching tool