Card 06/ 09
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.
| Device | Reads | Decides | Layer |
|---|---|---|---|
| Hub | Nothing: it repeats the signal | Nothing; every port gets every bit | 1 |
| Switch | Ethernet header: MAC addresses | Which port leads to the destination card | 2 |
| Router | IP header: IP addresses | Which network to send the packet to next | 3 |
| Network load balancer | TCP or UDP header: ports | Which server receives this connection | 4 |
| Application load balancer | HTTP request: path, host, headers | Which server receives this request | 7 |
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.
← → move through sections and cards