COMP347 (Revision 10) | TrustOpen University
Upon completion of this expanded tutorial, students will be able to:
The complexity of computer networks makes it impossible to design a monolithic system that handles all aspects of communication. Instead, networks are organised into layers, each responsible for a specific function. This tutorial provides a rigorous examination of protocol layering principles, the service models that define how layers interact, and the specific layers of the Internet protocol stack. We also examine the OSI reference model, compare it with the Internet stack, and discuss the hourglass model and the end‑to‑end principle. Understanding layering is fundamental to understanding how networks operate—it provides the conceptual framework for the entire course.
Computer networks are incredibly complex systems. A single communication involves physical transmission, error detection and correction, addressing and routing, flow control, security, and application‑specific formatting. Without organisation, this complexity would be unmanageable.
Layering addresses this by:
Each layer has a name for its data unit:
| Layer | PDU Name |
|---|---|
| Application | Message |
| Transport (TCP) | Segment |
| Transport (UDP) | Datagram |
| Network (IP) | Datagram |
| Link | Frame |
| Physical | Bit |
Encapsulation is the process of wrapping data from a higher layer with the header (and sometimes trailer) of a lower layer as it passes down the stack.
Encapsulation process (sending):
Decapsulation process (receiving):
The Internet protocol stack consists of five layers. We detail each layer's functions and key protocols.
Purpose: Provides services to user applications.
Purpose: Provides end‑to‑end communication between processes.
Purpose: Moves packets from source to destination across multiple networks.
Purpose: Moves frames from one node to the next on the same link.
Purpose: Moves individual bits across the physical medium.
The OSI (Open Systems Interconnection) model is a seven‑layer model developed by ISO. It provides a conceptual framework for understanding network functions.
| Layer | Function | Key Protocols/Examples |
|---|---|---|
| 7. Application | User interface and application‑specific services | HTTP, FTP, SMTP, Telnet |
| 6. Presentation | Data formatting, encryption, compression | JPEG, MPEG, TLS (partly) |
| 5. Session | Session establishment, management, and termination; dialog control; synchronisation | NetBIOS, RPC (partly) |
| 4. Transport | End‑to‑end communication, segmentation, flow control, error recovery | TCP, UDP |
| 3. Network | Routing, addressing, forwarding | IP, IPX |
| 2. Data Link | Node‑to‑node communication, framing, error detection, MAC | Ethernet, Wi‑Fi, PPP |
| 1. Physical | Bit transmission, signal encoding, physical interfaces | Ethernet PHY, 802.11 PHY |
The OSI model adds Presentation and Session layers, which in the Internet stack are handled at the application layer (e.g., TLS for encryption, cookies for sessions).
| Aspect | Internet Stack | OSI Model |
|---|---|---|
| Number of layers | 5 | 7 |
| Origin | Practical (ARPANET) | Theoretical (ISO) |
| Adoption | Widely implemented | Primarily conceptual |
| Presentation layer | Application layer | Separate layer |
| Session layer | Application/Transport | Separate layer |
| Connection model | Connectionless + Connection‑oriented | Connection‑oriented |
| Protocols | TCP/IP suite | OSI protocols (rarely used) |
The Internet architecture is often described as an hourglass shape: at the waist is the Internet Protocol (IP), which provides a common, minimal service (best‑effort datagram delivery) over many link‑layer technologies and supports many transport‑layer protocols and applications above. This narrow waist enables innovation at both the lower and upper layers without requiring changes to IP, making the Internet scalable and extensible.
The end‑to‑end principle, articulated by Saltzer, Reed, and Clark (1984), states that functions should be implemented at the communication endpoints whenever possible, rather than in the network core. The Internet reflects this principle by keeping the core simple (best‑effort IP) and placing reliability (TCP) and security (TLS) at the endpoints. This allows for rapid innovation at the application layer.
| Layer | Entity |
|---|---|
| Application | Applications, browsers, servers |
| Transport | TCP/UDP implementation (OS kernel) |
| Network | IP implementation, routers |
| Link | Network interface cards (NICs), switches |
| Physical | Cables, connectors, antennas, transceivers |
Layers interact through service primitives:
For example, in TCP, connect (request), listen (indication), accept (response), and connected (confirm) are analogous.
Q1: What is the primary purpose of protocol layering in computer networks?
To decompose complexity into manageable, independent layers with specific responsibilities, enabling modularity and interoperability.
Q2: What is encapsulation? Give an example.
Encapsulation is wrapping data from a higher layer with the header of a lower layer. Example: HTTP message → TCP segment → IP datagram → Ethernet frame.
Q3: What are the five layers of the Internet protocol stack, in order from top to bottom?
Application, Transport, Network, Link, Physical.
Q4: What is the primary function of the transport layer?
End‑to‑end communication between processes, including segmentation, error control, flow control, and congestion control.
Q5: How does the network layer differ from the link layer?
The network layer moves packets across multiple networks (routing, forwarding); the link layer moves frames from one node to the next on the same link.
Q6: What is a Protocol Data Unit (PDU)? Name the PDUs for each layer of the Internet stack.
A PDU is the data unit at a specific layer. Application: message; Transport: segment/datagram; Network: datagram; Link: frame; Physical: bit.
Q7: How many layers does the OSI reference model have, and how does it differ from the Internet stack?
OSI has 7 layers, adding Presentation and Session. The Internet stack combines these into the Application layer.
Q8: What is the purpose of the presentation layer in the OSI model?
Data formatting, translation, encryption, and compression.
Q9: What is a service access point (SAP)?
A point where a layer provides its service to the layer above (e.g., a socket in TCP/IP).
Q10: What is the hourglass model of the Internet architecture?
IP is at the waist; many applications above and many link technologies below, enabling interoperability and innovation.
Q11: Explain the end‑to‑end principle and give an example.
Functions should be implemented at the endpoints whenever possible. Example: TCP provides reliability at endpoints, not in routers.
Q12: What are the four types of service primitives?
Request, Indication, Response, Confirm.
Exercise 1 – Encapsulation diagram
Draw and label the encapsulation process for an HTTP request from a browser to a web server. Show the headers added at each layer and the resulting PDUs.
Exercise 2 – Modularity examples
Explain how the layered architecture enables innovation at the application layer without changing the network core. Give two examples.
Applications can evolve independently because they only interact with the transport layer (socket API). Examples: HTTP/1.1 → HTTP/2 → HTTP/3 did not require changes to TCP or IP; new applications like WebRTC can be deployed without modifying routers.
Exercise 3 – Internet vs OSI
Why does the Internet stack not include separate presentation and session layers? What are the advantages and disadvantages?
Advantages: simplicity, efficiency, flexibility, adherence to end‑to‑end principle. Disadvantages: more work for applications (must handle formatting and session management), less standardisation.
Exercise 4 – TCP vs UDP service models
Compare TCP and UDP. For each of the following applications, explain which transport protocol is more appropriate: (a) web browsing, (b) DNS queries, (c) VoIP, (d) file transfer, (e) live video streaming.
TCP: web browsing, file transfer (need reliability). UDP: DNS (small queries), VoIP, live video (speed, loss tolerance).
Exercise 5 – Service primitive example
Describe the service primitive sequence for a TCP connection establishment using Request, Indication, Response, Confirm.
Client sends CONNECT.request (SYN); server receives CONNECT.indication; server sends CONNECT.response (SYN‑ACK); client receives CONNECT.confirm (ACK).
Exercise 6 – Hourglass model significance
Explain why the hourglass model is considered the key to the Internet's success.
It allows innovation at both the link layer (new technologies like Wi‑Fi) and the application layer (new protocols like HTTP/3) without changing IP, ensuring interoperability and scalability.
Homework 1 – OSI history
Research the history of the OSI reference model. Why was it developed? Why did TCP/IP succeed while OSI largely failed?
OSI was comprehensive but complex and slow; TCP/IP was practical, had working implementations, and was incrementally deployable.
Homework 2 – IETF and RFCs
Describe the IETF standards process from Internet‑Draft to Internet Standard. Why is "rough consensus" important?
Stages: Internet‑Draft → Proposed Standard → Draft Standard → Internet Standard. Rough consensus ensures practical, working solutions without formal voting.
Homework 3 – End‑to‑end principle violations
Identify three examples where the end‑to‑end principle is violated in today's Internet (e.g., NAT, firewalls). Explain why these violations are considered necessary.
NAT (address shortage), firewalls (security), CDNs (performance). These are practical trade‑offs.
Homework 4 – Service primitives in practice
Using the socket API, map the system calls (socket, bind, listen, accept, connect, read, write, close) to service primitives (Request, Indication, Response, Confirm).
connect() → Request/Confirm; accept() → Indication/Response; read/write → data transfer primitives.
Homework 5 – Microservices and layering
Explain how modern microservices architectures relate to the concept of protocol layering. Are they following the same principles?
Microservices use lightweight protocols and APIs, similar to layering but at the application level; they emphasise modularity and independent deployability.
This tutorial has explored the principles of protocol layering and network architectures:
Understanding layering is essential for understanding how networks operate and how protocols interact. In the next tutorial, we will examine the Internet protocol stack and the OSI reference model in greater detail, including protocol header formats and service interfaces.