XP1,240
Simulation · 01

Hub vs Switch

Both connect devices together but their working principles are very different!

Duration
2min
Level
L4
Type
Simulation
Progress
1/ 5

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:

PortMAC Address
1AA:BB:CC:DD:EE:01
2AA:BB:CC:DD:EE:02
3AA:BB:CC:DD:EE:03

03Comparison

FeatureHubSwitch
OSI LayerLayer 1Layer 2
Intelligent?NoYes
Data SendingBroadcastUnicast
CollisionYesNo
SpeedLowHigh
SecurityLowMedium
PriceCheapMedium

04Summary

  • Hub = "Dumb" device, sends to everyone
  • Switch = Smart device, sends only to target
  • Modern networks use switches, not hubs