The layer models
Each layer does one job and trusts the one below
The OSI model names seven layers; the TCP/IP model the internet runs on names four.
Every network conversation is split into layers, and each layer has one job. At the top, the application layers: the web, email, name lookups, and the encryption and formats they use. Below them, transport, which gets data from one program to another, reliably with TCP or quickly with UDP. Then the network layer, which carries packets from one host to any other host in the world, using IP addresses. And at the bottom, the link and the physical medium: Ethernet frames over copper, fibre, or radio. The exams speak in the seven OSI layers. The internet runs on the four TCP/IP layers on the right. Transport and network line up exactly in both.
Encapsulation
Each layer wraps the data in its own header
Encapsulation: TCP, IP and Ethernet each add a header, so a 420-byte request leaves as a 478-byte frame.
Here is what actually leaves your computer when you ask for a web page. The browser writes a request, about four hundred and twenty bytes of text. TCP puts a twenty-byte header in front of it, with the port numbers and a sequence number. IP puts its own twenty bytes in front of that, with the source and destination addresses. And Ethernet wraps the lot in a frame: fourteen bytes of MAC addresses in front, and a four-byte checksum behind. 478 bytes in all. The server does the same thing in reverse, peeling off one header at each layer until only the request is left.
Encapsulation · Going deeper · 1 of 3
The Ethernet frame, field by field
A frame carries 46 to 1500 bytes of payload. The MTU is 1500, which leaves an MSS of 1460 bytes for TCP data.
Encapsulation · Going deeper · 2 of 3
The IPv4 header, field by field
A router reads the destination address and lowers the time to live by one. The protocol field says what is inside: 6 for TCP, 17 for UDP.
Encapsulation · Going deeper · 3 of 3
The TCP and UDP headers
TCP’s 20-byte header carries ports, sequence numbers, flags and a window. UDP’s 8 bytes carry only ports, length and a checksum.
Lesson complete
You finished “The layer model”
Nicely done.