Standard definitions of the Internet protocol stack and the ISO OSI reference model, as taught in introductory networking courses (Kurose and Ross, sections 1.1, 1.5 and 1.7). History dates were checked against the standard published timeline.
Say the five layers out loud from top to bottom until it is automatic, then learn the packet name that goes with each. The encapsulation section will make sense in one read once those two lists are solid.
What a protocol is#
When you ask a stranger for the time, you follow a routine without thinking. You say “excuse me”, wait for them to look up, ask, and then say thanks. If they ignore the “excuse me”, you do something different. That routine is a protocol.
A network protocol is the same thing for machines. It defines three things:
- the format of the messages exchanged,
- the order in which they are sent and received, and
- the actions taken when a message arrives, or when an expected message does not.
Format, order, actions. Any exam definition of “protocol” that names all three earns full marks.
Why networks are built in layers#
Think of sending a letter overseas. You write it and put it in an envelope. The post office sorts it. A plane carries a sack of mail. At no point does the pilot need to read your letter, and you do not need to know how the plane flies. Each stage does one job and passes the result on.
Networks are built the same way. Each layer provides a service to the layer above it, using the service of the layer below it. The benefits:
- It breaks a huge problem into parts. Each layer can be designed and understood on its own.
- A layer can change without breaking the others. Wi-Fi can replace Ethernet at the bottom, and your web browser never notices.
The standard complaint against layering is that layers can duplicate work (for example, error checking at more than one layer) and that a layer sometimes needs information another layer hides.
The five layers of the Internet protocol stack#
From the top, the layer closest to you, down to the wire:
| Layer | Job | Examples | What its packet is called |
|---|---|---|---|
| 5. Application | Supports network applications. | HTTP, SMTP, DNS | Message |
| 4. Transport | Carries messages between processes on two hosts. | TCP, UDP | Segment |
| 3. Network | Moves packets from the source host to the destination host, across many routers. | IP, routing protocols | Datagram |
| 2. Link | Moves a packet across one link, to the next device. | Ethernet, Wi-Fi (802.11) | Frame |
| 1. Physical | Moves the individual bits across the medium. | Depends on the medium: copper, fiber, radio | Bits |
A packet at each layer is called that layer's protocol data unit, or PDU. Learning the four PDU names is worth the effort: exam questions use them without explanation.
Top to bottom: All Teachers Need Long Pauses. Application, Transport, Network, Link, Physical. And the packets: Message, Segment, Datagram, Frame.
Network layer is host to host. Link layer is one hop. The network layer gets a datagram all the way across the Internet. The link layer only ever gets a frame to the next device on the path. Transport is process to process: it delivers to the right program on the host, not just to the host.
The OSI model: two extra layers#
The ISO OSI reference model is an older, seven-layer model you will also be asked about. It has the same five layers plus two more between application and transport:
| Extra OSI layer | What it provides |
|---|---|
| Presentation | Lets applications interpret the meaning of data: encryption, compression, and translating data formats between machines. |
| Session | Keeps a conversation organized: synchronization, checkpointing, and recovery of a data exchange. |
Full OSI order, top to bottom: application, presentation, session, transport, network, data link, physical.
So where did those two go in the Internet stack? Nowhere: the Internet leaves them to the application. If an application needs encryption or checkpointing, the application builds it in. If it does not, it does not pay for it.
OSI has seven layers; the Internet stack has five. A question asking “which layers are missing from the Internet stack?” wants presentation and session.
Encapsulation: envelopes inside envelopes#
Here is what happens when your browser sends a request. Each layer on the way down takes what it was handed and adds its own header, a small block of control information, to the front. It is like putting a letter in an envelope, then putting that envelope in a bigger envelope with a different address.
| Layer | Does | Result |
|---|---|---|
| Application | Creates the message M. | M |
| Transport | Adds transport header Ht (for example, the port numbers). | Ht M = segment |
| Network | Adds network header Hn (source and destination IP addresses). | Hn Ht M = datagram |
| Link | Adds link header Hl (the address of the next device). | Hl Hn Ht M = frame |
| Physical | Sends the frame as bits. | bits |
On the receiving side the process runs in reverse. Each layer reads its own header, strips it off, and passes what is left up. This is decapsulation.
At each layer, the thing being wrapped is called the payload. The transport segment is the payload of the network datagram. The datagram is the payload of the link frame.
Which devices use which layers
Not every device needs the whole stack. A device only goes as high as it must to do its job:
| Device | Layers implemented | Why |
|---|---|---|
| Host (end system) | All 5 | It runs the applications, so it needs every layer. |
| Router | Layers 1 to 3 | It reads IP addresses to forward datagrams, which is a network-layer job. |
| Link-layer switch | Layers 1 to 2 | It forwards frames within one network using link-layer addresses. |
A router does not run TCP for your connection, and it does not read HTTP. It opens the envelopes only as far as the network layer, reads the destination IP address, and forwards. Transport and application exist only at the two end hosts.
Going down the stack each layer adds a header, going up each layer removes one, and the packet names are message, segment, datagram, frame.
A short history of the Internet#
Exams usually ask for the order of events and why they mattered, not exact dates. Here is the order:
| Period | What happened |
|---|---|
| 1961 to 1972 | Packet switching is developed as an idea. Leonard Kleinrock shows queuing theory suits bursty traffic. ARPAnet, funded by the U.S. Advanced Research Projects Agency, gets its first node in 1969. By 1972 it has about 15 nodes, the first host-to-host protocol (NCP), and the first e-mail program. |
| 1972 to 1980 | Many separate networks appear: ALOHAnet (a radio network in Hawaii, 1970), Ethernet at Xerox PARC (built 1973, published 1976), and company networks. In 1974 Vinton Cerf and Robert Kahn describe an architecture for connecting networks together: an internet. |
| 1980 to 1990 | The protocols we still use arrive. TCP/IP replaces NCP on ARPAnet on 1 January 1983. SMTP (1982), DNS (1983) and FTP (1985) are defined. TCP congestion control is added in 1988. |
| 1990s | ARPAnet is retired (1990) and commercial use grows. Tim Berners-Lee creates the World Wide Web: HTML, HTTP, a server and a browser. Graphical browsers arrive (Mosaic, then Netscape). The Web is what makes the Internet popular with the public. |
| 2000s to now | Broadband and wireless access spread. Smartphones put the Internet in pockets. Billions of devices connect. Huge content providers such as Google and Netflix build their own networks, and cloud computing moves services into large data centers. |
Idea (packet switching), then one network (ARPAnet), then many networks joined (TCP/IP, 1983), then the Web for everyone (1990s), then everything mobile.
Practice#
Answer from memory first. The layer and PDU lists should come out without looking.
- Give the three things a protocol defines.
- List the five layers of the Internet stack from top to bottom, with the name of each layer's packet.
- Give two advantages of layering and one disadvantage.
- Name the two OSI layers that the Internet stack does not have, and say what each provides.
- Where does the work of those two layers happen in the Internet?
- A browser sends a request. Write the frame that leaves the host, in the H? M notation, and say what the transport segment is to the network layer.
- Which layers does a router implement, and why does it stop there?
- Which layer moves data between processes, and which moves data between hosts?
- Put these in order: the World Wide Web, the first ARPAnet node, the switch to TCP/IP, Kleinrock's queuing work.
Solutions#
Find the first line where your working split from the solution, and redo the problem from that line. Do not just read the answer and nod.
- Format, order, actions. The format of the messages, the order they are sent and received in, and the actions taken when a message arrives or fails to.
- Application (message), transport (segment), network (datagram), link (frame), physical (bits).
- Advantages: it breaks a complex system into manageable parts, and one layer's implementation can change without affecting the others. Disadvantage: functions can be duplicated across layers, or a layer may need information another layer hides.
- Presentation and session. Presentation handles the meaning of data: encryption, compression and format conversion. Session handles synchronization, checkpointing and recovery of a data exchange.
- In the application. The Internet leaves those services to the application developer, who builds them in if needed.
- Hl Hn Ht M. The transport segment (Ht M) is the payload of the network-layer datagram.
- Physical, link and network (1 to 3). Its job is forwarding datagrams by IP address, a network-layer task. It has no need to open the transport or application layers.
- Transport between processes; network between hosts. The transport layer delivers to the right process (program) on a host. The network layer delivers from one host to another.
- Kleinrock's queuing work (1961), first ARPAnet node (1969), switch to TCP/IP (1983), the World Wide Web (early 1990s).
Test-readiness checklist#
- ☐ I can define a protocol by format, order and actions.
- ☐ I can give the five layers in order, with each layer's job and PDU name.
- ☐ I can explain two benefits of layering and one cost.
- ☐ I can name the two extra OSI layers and say what they do and where their work goes in the Internet.
- ☐ I can describe encapsulation and decapsulation with the H M notation.
- ☐ I can say which layers hosts, routers and switches implement.
- ☐ I can put the major events of Internet history in order.
Use the right packet name for the layer. Calling a transport-layer packet a “datagram” or a link-layer packet a “segment” costs marks on questions that are otherwise correct.
Frequently asked questions#
What are the five layers of the Internet protocol stack?
From top to bottom: application, transport, network, link and physical. Their packets are called the message, segment, datagram and frame, and the physical layer carries individual bits.
What is the difference between the OSI model and the Internet protocol stack?
OSI has seven layers: it adds presentation and session between application and transport. The Internet stack has five layers and leaves presentation and session services to the application.
What is encapsulation in networking?
As data moves down the stack, each layer adds its own header in front of what it received. The application message becomes a transport segment, then a network datagram, then a link-layer frame. The receiver removes the headers in reverse order.
Which layers does a router implement?
The physical, link and network layers. A router forwards datagrams using their IP addresses, which is a network-layer job. Transport and application layers exist only in the end hosts.
What is a protocol in computer networking?
A protocol defines the format and order of messages exchanged between two or more communicating entities, and the actions taken when a message is sent, received, or not received.
Something here not clear? A topic you wish we covered? Tell us. We read every message, and a request is the fastest way to get a guide written.
Test yourself on this topic
The free networking practice app has 19 questions on this topic and 500 across the whole course, each with an explanation for every answer. Offline, no ads, no account.
Practise this topic →