Card 01/ 09
The OSI Model: Seven Layers From Cable to Application
Seven layers, each with one job, so a network problem can be pinned to one of them.
The OSI model (Open Systems Interconnection) divides network communication into seven layers, from the physical signal on a cable at layer 1 to the application at layer 7. Each layer has one job and depends only on the layer below it, which is why engineers use the model to say where a network problem lives.
Picture a web page that will not load. The cause could be an unplugged cable, a wrong address, a program that is not listening, or a crashed server, and from the browser all four look the same. Each belongs to a different layer, so asking the layers in order turns one vague complaint into a short list of yes or no questions.
Every layer speaks a protocol, an agreed set of rules for what two machines send each other, and adds a header, a small block of fields in front of the data. Three addresses in those headers recur: a MAC address names one network card on the local link, an IP address names a machine across networks, and a port names one program on that machine.
| Layer | Holds | Lives for |
|---|---|---|
| 7 Application | Requests and responses a program sends, such as HTTP | Giving the program the service it asked for |
| 6 Presentation | The format of the data: encoding, compression, encryption | Making the bytes mean the same at both ends |
| 5 Session | A conversation between two programs, opened and closed | Keeping track of which exchange a message belongs to |
| 4 Transport | Segments addressed to ports: TCP, UDP | Reaching the right program, reliably when asked |
| 3 Network | Packets addressed by IP address | Choosing a path across many networks |
| 2 Data Link | Frames addressed by MAC address, as in Ethernet and Wi-Fi | Moving data to the next device on the same link |
| 1 Physical | Bits as voltage, light or radio | Sending ones and zeros across a cable or the air |
Each layer builds on the one below and hides it from the one above: Ethernet does not know a web page from an email, and HTTP does not know whether its bytes crossed copper or radio. That independence is why Wi-Fi could replace cables without a change to HTTP. A common way to remember the order from layer 1 upwards is "Please Do Not Throw Sausage Pizza Away".
The OSI model is a way to reason about networks, not software you install; the internet runs on the TCP/IP protocols, which fold the top three layers into one.
So when something fails, the first useful question is which layer it failed at, because the layer decides which tool can see the fault: a cable tester, ping, or the server's own logs.
← → move through sections and cards