Hub vs Switch
Both connect devices together but their working principles are very different!
01Hub
Hub works at OSI Layer 1 (Physical).
How It Works?
code
Hub
/ | \
PC1 PC2 PC3
PC1 → Hub → Send to everyone (broadcast)
Features:
- ❌ No intelligence - sends incoming data to everyone
- ❌ Collisions occur
- ❌ Bandwidth is shared
- ❌ No security
- ✅ Cheap
Collision Domain:
All devices connected to a hub are in the same collision domain. If two devices send data at the same time, collision occurs!
02Switch
Switch works at OSI Layer 2 (Data Link).
How It Works?
code
Switch (MAC Table)
/ | \
PC1 PC2 PC3
PC1 → Switch → Send only to PC2 (unicast)
Features:
- ✅ Keeps MAC address table
- ✅ Sends only to destination port
- ✅ Each port is separate collision domain
- ✅ Full bandwidth
- ✅ More secure
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 |
03Comparison
| Feature | Hub | Switch |
|---|---|---|
| OSI Layer | Layer 1 | Layer 2 |
| Intelligent? | No | Yes |
| Data Sending | Broadcast | Unicast |
| Collision | Yes | No |
| Speed | Low | High |
| Security | Low | Medium |
| Price | Cheap | Medium |
04Summary
- Hub = "Dumb" device, sends to everyone
- Switch = Smart device, sends only to target
- Modern networks use switches, not hubs