📚 Tutorial 5: Protocols, Layering, and Network Architectures

COMP347 (Revision 10) | TrustOpen University

📑 Table of Contents

🎯 Learning Objectives

Upon completion of this expanded tutorial, students will be able to:

🔭 Overview

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.


1. The Need for Protocol Layering

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:


2. Principles of Layering

2.1 Layer Responsibilities

2.2 Service Models and Service Access Points (SAPs)

2.3 Protocol Data Units (PDUs)

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

3. Encapsulation and Decapsulation

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):

  1. Application creates a message.
  2. Transport layer adds its header (segment).
  3. Network layer adds its header (datagram).
  4. Link layer adds its header and trailer (frame).
  5. Physical layer transmits bits.

Decapsulation process (receiving):

  1. Physical layer receives bits.
  2. Link layer removes header and trailer.
  3. Network layer removes header.
  4. Transport layer removes header.
  5. Application receives the message.
Application data ↓ [Transport header | Application data] = Segment ↓ [Network header | Transport header | Application data] = Datagram ↓ [Link header | Network header | Transport header | Application data | Link trailer] = Frame

4. The Internet Protocol Stack (TCP/IP Model)

The Internet protocol stack consists of five layers. We detail each layer's functions and key protocols.

4.1 Application Layer

Purpose: Provides services to user applications.

4.2 Transport Layer

Purpose: Provides end‑to‑end communication between processes.

4.3 Network Layer

Purpose: Moves packets from source to destination across multiple networks.

4.4 Link Layer

Purpose: Moves frames from one node to the next on the same link.

4.5 Physical Layer

Purpose: Moves individual bits across the physical medium.


5. The OSI Reference Model

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).


6. Comparison: Internet Stack vs. OSI Model

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)

7. The Hourglass Model

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.


8. The End‑to‑End Principle

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.


9. Network Entities and Service Primitives

9.1 Network Entities

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

9.2 Service Primitives

Layers interact through service primitives:

For example, in TCP, connect (request), listen (indication), accept (response), and connected (confirm) are analogous.


📝 Quiz: Tutorial 5

Q1: What is the primary purpose of protocol layering in computer networks?

Answer

To decompose complexity into manageable, independent layers with specific responsibilities, enabling modularity and interoperability.

Q2: What is encapsulation? Give an example.

Answer

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?

Answer

Application, Transport, Network, Link, Physical.

Q4: What is the primary function of the transport layer?

Answer

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?

Answer

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.

Answer

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?

Answer

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?

Answer

Data formatting, translation, encryption, and compression.

Q9: What is a service access point (SAP)?

Answer

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?

Answer

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.

Answer

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?

Answer

Request, Indication, Response, Confirm.


✏️ Exercises: Tutorial 5

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.

Solution
Browser (Client) Application: HTTP Request (Message) ↓ Transport: TCP header added → Segment ↓ Network: IP header added → Datagram ↓ Link: Ethernet header and trailer added → Frame ↓ Physical: Bits transmitted Web Server (receive): Physical → Link (remove Ethernet) → Network (remove IP) → Transport (remove TCP) → Application (HTTP Request)

Exercise 2 – Modularity examples

Explain how the layered architecture enables innovation at the application layer without changing the network core. Give two examples.

Solution

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?

Solution

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.

Solution

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.

Solution

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.

Solution

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: Tutorial 5

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?

Guidance

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?

Guidance

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.

Guidance

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).

Guidance

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?

Guidance

Microservices use lightweight protocols and APIs, similar to layering but at the application level; they emphasise modularity and independent deployability.


📌 Summary

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.