hop 2 of 32 · 5 min
Why it is built in layers
Your browser does not know whether the connection is fibre, Wi-Fi or a mobile network. It does not need to. That is layering, and it is the single design decision that made the internet possible.
Each layer does one job and hands the result down, treating everything below it as a black box that moves bytes.
| TCP/IP layer | Job | Address it uses |
|---|---|---|
| Application | What the message means | A URL |
| Transport | Deliver to the right program, reliably | A port |
| Network | Get across networks | An IP address |
| Link | Get to the next device on this wire | A MAC address |
| Physical | Bits on a medium | None |
The OSI model
The seven-layer OSI model splits the application layer into three: application, presentation and session. It is what exams ask about; TCP/IP with four or five layers is what actually runs.
| OSI | TCP/IP |
|---|---|
| Application, Presentation, Session | Application |
| Transport | Transport |
| Network | Internet |
| Data link, Physical | Link |
Encapsulation
Going down, each layer wraps what it was given:
[ HTTP request ]
[ TCP header | HTTP request ]
[ IP header | TCP header | HTTP request ]
[ Frame header | IP header | TCP header | HTTP request | Frame trailer ]Going up, each layer unwraps its own header and passes the rest along. A router opens the frame and the IP header, never the TCP header, and certainly not the HTTP request.