← All chapters
Chapter 29· 8 min read · illustrated

Hubs, Switches & Routers

The three devices that build networks — and how traffic is addressed to one, all, or a group

We have talked about routers a lot, but they are one of three classic devices that move frames and packets around. Understanding hub vs switch vs router — and the layer each works at — ties the whole physical picture together.

01

The hub (layer 1)

A hub is the simplest and dumbest device. It has no intelligence: any signal arriving on one port is blindly repeated out of every other port. That wastes bandwidth and causes collisions, which is why hubs are essentially obsolete today. A hub operates at layer 1 (physical).

Tap to enlarge
02

The switch (layer 2)

A switch is the smart replacement for a hub. It learns which MAC address lives on which port and builds a MAC address table. When a frame arrives, it forwards it only to the correct port — no flooding. Switches operate at layer 2 (data link) using MAC addresses, and they are what connects devices within a network.

Tap to enlarge
03

The router (layer 3)

A router connects different networks together. It works at layer 3 (network) using IP addresses and a routing table to decide the next hop, exactly as we saw in the routing chapter. Switches move frames within a network; routers move packets between networks.

Tap to enlarge
04

Hub vs switch vs router

Hub
Layer 1 · copies to all ports · no addressing.
Switch
Layer 2 · forwards by MAC · within a network.
Router
Layer 3 · forwards by IP · between networks.
Tap to enlarge
05

Unicast, broadcast, multicast

Traffic can be addressed to different audiences:

Unicast
One sender to one specific receiver (the usual case).
Broadcast
One sender to everyone on the network — how ARP and DHCP Discover work.
Multicast
One sender to a subscribed group — e.g. streaming to many receivers.
Tap to enlarge
06

Broadcast domains

A broadcast reaches every device in its network — but routers do not forward broadcasts, so they act as boundaries. Everything a broadcast can reach is one broadcast domain. This is a big reason we split large networks into subnets: to keep broadcast traffic contained.

Tap to enlarge