Protocols and Layers
IB Syllabus: A2.1.4 – Network protocols for transport and application, A2.1.5 – Function of the TCP/IP model (HL)
Table of Contents
- Key Concepts
- Worked Examples
- Quick Check
- Trace Exercise
- Spot the Error
- Fill in the Blanks
- Predict the Output
- Practice Exercises
- Connections
Key Concepts
What is a Protocol? (A2.1.4)
A protocol is a set of rules that govern how data is formatted, transmitted, and received across a network.
Without agreed protocols, devices from different manufacturers could not communicate – each would use its own incompatible format. Protocols provide a common language that ensures interoperability.
Key protocol functions include:
- Data formatting – defining how data is structured and encoded
- Addressing – identifying the sender and receiver
- Routing – determining the path data takes through the network
- Error detection – identifying corrupted or lost data
- Flow control – managing the rate of data transmission to prevent overwhelming the receiver
Transport Protocols (A2.1.4)
The transport layer provides end-to-end communication between applications on different devices. The two main transport protocols are TCP and UDP.
TCP (Transmission Control Protocol)
- Connection-oriented: establishes a connection before sending data using a three-way handshake (SYN → SYN-ACK → ACK)
- Reliable: guarantees delivery through acknowledgements and retransmission of lost packets
- Ordered: packets are reassembled in the correct order at the destination
- Flow control: adjusts transmission speed to prevent overwhelming the receiver
- Use cases: web browsing, email, file transfer – where accuracy matters more than speed
UDP (User Datagram Protocol)
- Connectionless: no handshake – data is sent immediately without establishing a connection
- Unreliable: no guarantee of delivery, no acknowledgements, no retransmission
- Unordered: packets may arrive out of order
- Fast: minimal overhead, lower latency
- Use cases: live video streaming, online gaming, VoIP, DNS lookups – where speed matters more than perfect accuracy
TCP vs UDP Comparison
| Feature | TCP | UDP |
|---|---|---|
| Connection | Connection-oriented (handshake) | Connectionless |
| Reliability | Guaranteed delivery (ACKs) | No guarantee |
| Ordering | Packets reassembled in order | May arrive out of order |
| Speed | Slower (overhead for reliability) | Faster (minimal overhead) |
| Error checking | Yes + retransmission | Basic checksum only |
| Use cases | Web, email, file transfer | Streaming, gaming, VoIP |
Exam tip: A common question asks “Why would UDP be preferred over TCP for live video streaming?” The answer: a few dropped frames are barely noticeable, but the delay caused by TCP’s retransmission mechanism would cause visible lag and buffering. Real-time applications prioritise speed over perfect accuracy.
Application Protocols (A2.1.4)
Application protocols operate at the highest level, providing services directly to user applications.
| Protocol | Full Name | Function | Port |
|---|---|---|---|
| HTTP | Hypertext Transfer Protocol | Transfers web pages between browser and server; data sent in plaintext | 80 |
| HTTPS | HTTP Secure | Same as HTTP but encrypted using SSL/TLS; protects data in transit | 443 |
| DHCP | Dynamic Host Configuration Protocol | Automatically assigns IP addresses to devices when they join a network | 67/68 |
HTTP vs HTTPS: HTTP sends data in plaintext – anyone intercepting the traffic can read it (e.g., passwords, credit card numbers). HTTPS encrypts all data using SSL/TLS certificates, making interception useless. Modern browsers warn users when visiting HTTP sites. Always look for the padlock icon in the address bar.
The DHCP Process (DORA)
When a device joins a network, it needs an IP address. The DHCP protocol handles this automatically in four steps:
- Discover – the new device broadcasts “I need an IP address” to the network
- Offer – the DHCP server responds with an available IP address
- Request – the device accepts the offered address
- Acknowledge – the server confirms the assignment
Device DHCP Server
|--- DISCOVER (broadcast) --->|
|<--- OFFER (IP: 192.168.1.5) ---|
|--- REQUEST (accept offer) -->|
|<--- ACKNOWLEDGE (confirmed) ---|
Enrichment: Protocol Functions
This goes beyond the IB syllabus but helps build understanding.
Protocols perform several critical functions:
- Data integrity: checksums detect corrupted data during transmission
- Flow control: sender adjusts speed so the receiver is not overwhelmed
- Congestion management: protocols detect and respond to network congestion (e.g., TCP slow start)
- Deadlock prevention: protocols include timeout mechanisms to prevent indefinite waiting
- Port numbers: identify which application should receive incoming data (e.g., port 80 = HTTP, port 443 = HTTPS, port 53 = DNS)
The TCP/IP Model (A2.1.5)
HL Only – The TCP/IP model and its four layers are assessed at HL only. SL students should understand protocols (A2.1.4) but are not required to describe the layered model.
The TCP/IP model (also called the Internet Protocol Suite) organises network communication into four layers. Each layer has a specific role and interacts with the layers above and below it.
| Layer | Name | Role | Protocols | Devices |
|---|---|---|---|---|
| 4 | Application | Provides services directly to user applications | HTTP, HTTPS, DHCP, DNS, SMTP | – |
| 3 | Transport | Ensures reliable (TCP) or fast (UDP) end-to-end delivery | TCP, UDP | – |
| 2 | Internet | Handles addressing and routing packets across networks | IP (IPv4, IPv6) | Routers |
| 1 | Network Interface | Manages physical transmission of data over the medium | Ethernet, Wi-Fi (802.11) | NICs, switches, cables |
How the Layers Interact
Sending data (encapsulation):
Application Layer: [DATA]
↓ adds application header
Transport Layer: [TCP Header | DATA]
↓ adds source/dest port numbers
Internet Layer: [IP Header | TCP Header | DATA]
↓ adds source/dest IP addresses
Network Interface: [Frame Header | IP Header | TCP Header | DATA | Frame Trailer]
↓ adds MAC addresses + error checking
Transmitted as electrical/optical/radio signals
Receiving data (de-encapsulation): the reverse process – each layer strips its header and passes the data up to the next layer.
Encapsulation is a key exam concept. At each layer, a header is added containing information needed for that layer’s function. The receiving device removes headers in reverse order. This layered approach means each layer only needs to understand its own protocol – it does not need to know how other layers work.
Benefits of the Layered Model
- Modularity: each layer can be developed and updated independently
- Interoperability: devices from different manufacturers can communicate if they follow the same layer protocols
- Troubleshooting: problems can be isolated to a specific layer
- Abstraction: each layer hides complexity from the layers above it
Enrichment: The OSI Model
This goes beyond the IB syllabus but helps build understanding.
The OSI (Open Systems Interconnection) model has 7 layers compared to TCP/IP’s 4. The IB syllabus specifies the TCP/IP model only. However, the OSI model is widely referenced in industry:
OSI Layer TCP/IP Equivalent 7. Application Application 6. Presentation Application 5. Session Application 4. Transport Transport 3. Network Internet 2. Data Link Network Interface 1. Physical Network Interface The key difference: TCP/IP’s Application layer combines OSI’s top three layers, and TCP/IP’s Network Interface combines the bottom two.
Worked Examples
Example 1: Choosing the Right Protocol
For each scenario, identify whether TCP or UDP is more appropriate and explain why.
| # | Scenario | Protocol | Explanation |
|---|---|---|---|
| 1 | Downloading a software update | TCP | File must arrive complete and uncorrupted; retransmission ensures no missing data |
| 2 | Live video call between two friends | UDP | Real-time interaction; retransmitting old frames would cause lag; a few lost frames are acceptable |
| 3 | Loading a secure banking website | TCP (+ HTTPS) | Financial data must be transmitted accurately and securely; every byte matters |
| 4 | Streaming a live football match | UDP | Minor frame drops are unnoticeable; low latency is critical for live viewing |
| 5 | Sending an email with an attachment | TCP | Email and attachment must arrive complete; reliability is essential |
Example 2: Tracing a Web Request Through TCP/IP Layers (HL)
Walk through what happens when a student types https://www.example.com into their browser:
| Step | Layer | What Happens |
|---|---|---|
| 1 | Application | Browser creates an HTTPS request for the web page |
| 2 | Transport | TCP breaks the request into segments, adds port numbers (source: random, dest: 443) |
| 3 | Internet | IP adds source and destination IP addresses; determines routing path |
| 4 | Network Interface | Data is framed with MAC addresses and transmitted as electrical/optical signals |
| 5 | Network Interface (server) | Server’s NIC receives the frame, strips the frame header |
| 6 | Internet (server) | IP layer checks destination address, strips IP header |
| 7 | Transport (server) | TCP reassembles segments in order, sends ACK |
| 8 | Application (server) | Web server processes the HTTPS request and sends the page back |
Quick Check
Q1. Which protocol guarantees delivery of data by using acknowledgements and retransmission?
Q2. A student is watching a live stream of a concert. Which protocol is most likely used for the video transmission?
Q3. What is the primary difference between HTTP and HTTPS?
Q4. What does DHCP automatically assign to a device when it joins a network?
Q5. (HL) In the TCP/IP model, which layer is responsible for routing packets across different networks using IP addresses?
Trace Exercise
Trace the DHCP process when a new laptop connects to a school Wi-Fi network. For each step, identify the message type sent by the device or server.
| Step | Actor | Action | Message Type |
|---|---|---|---|
| 1 | Laptop | Broadcasts to find a DHCP server | |
| 2 | DHCP Server | Responds with an available IP address | |
| 3 | Laptop | Accepts the offered IP address | |
| 4 | DHCP Server | Confirms the IP address assignment |
Spot the Error
A student wrote the following revision notes about protocols. Click the line with the error, then pick the fix.
Pick the correct fix for this line:
Fill in the Blanks
Complete the following statements about network protocols:
PROTOCOL SUMMARY
================
is connection-oriented and guarantees delivery using acknowledgements.
is connectionless and prioritises speed over reliability.
encrypts web traffic using SSL/TLS certificates.
automatically assigns IP addresses when devices join a network.
In the TCP/IP model, the layer is responsible for end-to-end delivery. Predict the Output
A gamer is playing an online multiplayer game. Their internet connection briefly drops 3 packets. The game uses UDP.
Will the game request those packets to be resent? (Type Yes or No)
A device connects to a network and is assigned IP address 192.168.1.15 by the DHCP server. The DHCP lease expires after 24 hours.
After 24 hours, what must the device do to keep using the network? (Type one word)
Practice Exercises
Core
-
Protocol Comparison – Create a table comparing TCP and UDP across five criteria: connection type, reliability, speed, ordering, and one real-world use case for each.
-
Application Protocols – Describe the function of HTTP, HTTPS, and DHCP. For each, explain one scenario where it is used in everyday life.
-
DHCP Process – Draw a diagram showing the four steps of the DHCP process (DORA). Label each step with what is sent and by whom.
Extension
-
Protocol Selection – For each scenario, recommend TCP or UDP and justify your choice: (a) a hospital sending patient records to a specialist, (b) a security camera streaming live footage, (c) an online exam submission system, (d) a multiplayer racing game.
-
TCP/IP Layers (HL) – Explain the role of each layer in the TCP/IP model. Describe what happens at each layer when you send an email, including what headers are added during encapsulation.
Challenge
- Protocol Design (HL) – Imagine you are designing a new protocol for a real-time language translation app that translates speech during a video call. Would you base it on TCP or UDP? Justify your choice by discussing: (a) the importance of speed vs accuracy, (b) how you would handle packet loss, (c) which TCP/IP layer your protocol would operate at, and (d) how flow control would work.
Connections
- Prerequisites: Network Fundamentals – understanding network types and devices provides the physical context for how protocols operate
- Related: OS Fundamentals – the OS implements the TCP/IP stack and manages protocol operations
- Forward: Data Transmission – packet switching (A2.3.3) relies on TCP/IP protocols for addressing and delivery
- Forward: Encryption – HTTPS uses SSL/TLS encryption (A2.4.4) to secure HTTP traffic
- Forward: Network Security – insecure protocols are a key vulnerability (A2.4.2)