Edexcel International Advanced Level Computer Science, point 12.1.1
Definition
The open systems interconnection (OSI) reference model is a conceptual framework that divides network communication into seven layers, each with a specific job. It was created by the International Organization for Standardization (ISO).
Function and why needed
- It breaks a complicated problem into smaller, manageable parts (decomposition and abstraction, Unit 2 topic 10).
- Each layer only talks to the layer directly above and below it, and uses a defined interface, so a layer can be changed without affecting the others.
- It lets different manufacturers' products work together ("open" standards).
- It gives a common language for describing and fixing network problems ("it's a layer 1 problem": a cable fault).
a. The seven layers
| Layer | Name | Job | Examples | Data unit |
|---|---|---|---|---|
| 7 | Application | Provides network services to the user's software | HTTP, HTTPS, FTP, SMTP, DNS | Data |
| 6 | Presentation | Formats, encodes, compresses and encrypts the data so both ends understand it | TLS encryption, JPEG, UTF-8 | Data |
| 5 | Session | Starts, manages and ends the conversation (a session) | Sessions, checkpoints | Data |
| 4 | Transport | End-to-end delivery: splits data into segments, numbers them, checks and retransmits (reliable) or sends without checks (fast) | TCP, UDP (ports) | Segment |
| 3 | Network | Addresses and routes packets between networks | IP, routers | Packet |
| 2 | Data link | Delivers frames between devices on the same network, using MAC addresses, with error detection | Ethernet, Wi-Fi, switches | Frame |
| 1 | Physical | Sends the raw bits as electrical, light or radio signals | Cables, fibre, radio, hubs | Bits |
Memory aid (7 to 1): All People Seem To Need Data Processing.
Layers and devices
- Physical: cables, repeaters, hubs.
- Data link: switches, NICs (3.1.1).
- Network: routers (3.1.1).
- Application to transport: the software on the end devices (and some firewalls).
b. Encapsulation and decapsulation
Encapsulation is each layer adding its own information (a header, and sometimes a trailer) around the data from the layer above, as data goes down the stack at the sender.
Decapsulation is the reverse at the receiver: each layer removes its own header and passes the contents up.
What each header adds:
| Layer | Adds | Example contents |
|---|---|---|
| Transport | Transport header | Source and destination port numbers, sequence number, acknowledgement, checksum |
| Network | Network (IP) header | Source and destination IP addresses, TTL, protocol |
| Data link | Frame header and trailer | Source and destination MAC addresses, error check (FCS) in the trailer |
| Physical | Nothing: converts to signals | Bits on the wire |
At the receiver, the frame is checked (data link), the packet's IP address matches (network), the segment is put in order and the port selects the right program (transport), and the data reaches the application.
Across several devices
A router only decapsulates up to layer 3, reads the IP address, then re-encapsulates in a new frame for the next link (with new MAC addresses). The IP addresses stay the same end to end, while MAC addresses change at every hop (3.1.3).
Worked example
Task: a browser sends a web request to a server. Describe what happens at each layer on the way down.
- Application (7): the browser creates an HTTP request (
GET /index.html). - Presentation (6): the data is encrypted (TLS) and encoded in a standard form.
- Session (5): a session with the server is kept open.
- Transport (4): TCP splits the data into segments, adds a header with the port numbers (source: random, destination: 443) and sequence numbers.
- Network (3): IP adds a header with the source and destination IP addresses, forming packets.
- Data link (2): the frame header adds the MAC address of the next device (the router) and a trailer for error checking.
- Physical (1): the frame is sent as bits (signals on the Wi-Fi or cable).
At the server, the layers decapsulate in reverse (1 to 7), and the web server program receives the request.
Exam tip: learn the seven layers in order and the job of each. For encapsulation, say that each layer adds a header (and sometimes a trailer) on the way down, and removes it on the way up. You may be asked to complete a diagram of packets flowing through the stack, so be sure which header belongs to which layer.
Check yourself
Give the seven OSI layers from top to bottom
Application, Presentation, Session, Transport, Network, Data link, Physical.
What is encapsulation?
Each layer adding its own header (and sometimes a trailer) to the data from the layer above as it passes down the stack.
Which layer uses IP addresses, and which uses MAC addresses?
The network layer uses IP addresses; the data link layer uses MAC addresses.
Give two benefits of a layered model
Any two of: breaks a complex problem into smaller parts; a layer can be changed without affecting others; different manufacturers' products work together; easier to find faults.
What happens to the headers at the receiver?
Each layer removes (decapsulates) its own header and passes the contents up to the next layer.