Hubs, Switches, and Routers Explained
Hubs, switches, and routers all have ports and blink lights. They look interchangeable on a desk. They are not. Each operates at a different layer of the OSI model and behaves very differently — knowing which is which is foundational.
Hub (Layer 1) — extinct but worth knowing
A hub is a “dumb” repeater. Whatever bits arrive on one port get blasted out to ALL other ports. No intelligence. No filtering.
- Half-duplex only — only one device can transmit at a time
- Collisions when two devices send simultaneously
- Bandwidth shared across all connected devices
- Anyone on the hub can sniff anyone else’s traffic
Hubs were replaced by switches in the early 2000s. You won’t see one in production today. Mentioned only to understand the history.
Switch (Layer 2) — the workhorse
A switch learns which MAC addresses are on which port and forwards frames only to the correct destination port.
- Full-duplex — every port can send and receive simultaneously at line rate
- No collision domain — switching fabric handles it
- Each port gets dedicated bandwidth
- One device can’t easily see another’s traffic (unless ARP poisoning, port mirroring)
How a switch learns
When a switch sees a frame from MAC address aa:bb:cc:11:22:33 on port 5, it records “MAC aa:bb:cc:11:22:33 is on port 5″ in its MAC table. Future frames destined for that MAC go only to port 5. Unknown destinations are flooded (sent to all ports).
# See MAC table on a Cisco switch
show mac address-table
# On Linux bridge
bridge fdb show
VLANs (the switch superpower)
One physical switch can be partitioned into multiple virtual switches. Devices on VLAN 10 can’t talk to devices on VLAN 20 without going through a router. Used everywhere for security and segmentation.
Router (Layer 3) — moves between networks
A router connects different IP networks and forwards packets based on IP addresses, not MAC addresses. This is the Layer 3 device.
- Each interface is on a different IP subnet
- Maintains a routing table — destination network → next hop
- Decrements the TTL on each packet (helps prevent loops)
- Performs NAT, ACLs, and other Layer 3 functions
What your home “router” actually is
Your home box is really 4 devices in one chassis:
- A modem (DSL/cable/fiber to the ISP)
- A router (between your LAN and the internet)
- A switch (4–8 wired ports for laptops/TVs)
- A wireless access point (Wi-Fi)
Layer 3 switch — the modern hybrid
Most enterprise “switches” are actually Layer 3 switches — they switch within VLANs (L2) AND route between VLANs (L3) at switching speed. Faster than running a separate router for inter-VLAN traffic.
Quick comparison
| Device | Layer | Decides on | Domain |
|---|---|---|---|
| Hub | L1 | Nothing — broadcasts | One collision domain, one broadcast domain |
| Switch | L2 | MAC address | Per-port collision domain, one broadcast domain (per VLAN) |
| Router | L3 | IP address | Each interface = separate broadcast domain |
Where each fits in a network
Internet
│
└── ISP Modem
│
└── Edge Router (NAT, firewall)
│
├── L3 Switch (multi-VLAN)
│ │
│ ├── VLAN 10: Office workstations
│ ├── VLAN 20: VoIP phones
│ └── VLAN 30: Servers
│
└── Wi-Fi access points
What to learn next
Firewalls — the security devices that decide which packets get through. Up next.