Card 06/ 09

ConceptDifficulty: Beginner2 min

Hubs, Switches, Routers and Load Balancers: Where Devices Sit

A device belongs to the highest layer whose header it reads to decide where data goes.

Network devices are placed on the OSI model by the highest layer whose header they read to decide where data goes. A switch reads MAC addresses, so it is a layer 2 device; a router reads IP addresses, so it is a layer 3 device. Knowing a device's layer tells you what it can see and so what it can get wrong.

Picture an office where the printer suddenly cannot be reached from one floor. If the device between the floors is a switch, the suspect is its table of MAC addresses or a cable. If it is a router, the suspect is a route or a firewall rule on IP addresses. The device's layer narrows the search before anyone opens a configuration screen.

Common network devices, the header each reads to decide, and the layer that places it
DeviceReadsDecidesLayer
HubNothing: it repeats the signalNothing; every port gets every bit1
SwitchEthernet header: MAC addressesWhich port leads to the destination card2
RouterIP header: IP addressesWhich network to send the packet to next3
Network load balancerTCP or UDP header: portsWhich server receives this connection4
Application load balancerHTTP request: path, host, headersWhich server receives this request7

A device reads every layer below its own as well, because it has to unwrap them to reach its header. A router removes the frame to read the packet, and an application load balancer removes the frame, the packet and the segment to read the HTTP request. What places it is the highest header it uses for the decision.

The rule also explains why some descriptions differ. A firewall that filters by IP address is a layer 3 device, and one that filters by port is layer 4; many products do both and are described by whichever their seller prefers. A load balancer is never a layer 3 device, though it is sometimes called one: it chooses a server by port or by request, which is layer 4 or layer 7.

A hub belongs to older networks and is rarely seen now, but it shows the rule from the bottom: a device that reads nothing decides nothing.

So before blaming a device for a fault, ask which header it reads. A switch cannot be the cause of a wrong route, and a router cannot be the cause of a wrong URL path.