Skip to content

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 layerJobAddress it uses
ApplicationWhat the message meansA URL
TransportDeliver to the right program, reliablyA port
NetworkGet across networksAn IP address
LinkGet to the next device on this wireA MAC address
PhysicalBits on a mediumNone

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.

OSITCP/IP
Application, Presentation, SessionApplication
TransportTransport
NetworkInternet
Data link, PhysicalLink

Encapsulation

Going down, each layer wraps what it was given:

code
                      [ 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.

Why it is built in layers