Expanded Edition – COMP347 (Revision 10) | TrustOpen University
Upon completion of this expanded tutorial, students will be able to:
This tutorial provides a detailed examination of the Internet protocol stack (TCP/IP model) and the OSI reference model. While the previous tutorial introduced the basic concepts of layering, this tutorial delves into the specific protocols, functions, and interactions at each layer. We explore the header formats of key protocols (TCP, IP, Ethernet), the encapsulation process in depth, and the service models. We also compare the two models and discuss the hourglass architecture and the end‑to‑end principle. Understanding both models is essential for network professionals, as the Internet stack is what we use in practice, while the OSI model provides a valuable conceptual framework.
The Internet protocol stack, also known as the TCP/IP model, consists of five layers. We will examine each layer in depth, including its functions, key protocols, and header formats.
Purpose: Provides services to user applications and defines the protocols used for specific applications.
Purpose: Provides end‑to‑end communication between processes on different hosts, with optional reliability.
Purpose: Moves packets from source to destination across multiple networks, providing addressing and routing.
Purpose: Moves frames from one node to the next on the same link, providing node‑to‑node delivery.
Purpose: Transmits individual bits across the physical medium, handling the electrical, optical, or radio characteristics.
The OSI (Open Systems Interconnection) model, developed by ISO, is a seven‑layer conceptual framework that standardises network communication.
| Layer | Name | Function | Examples |
|---|---|---|---|
| 7 | Application | Provides network services to user applications; application‑specific protocols. | HTTP, FTP, SMTP, Telnet |
| 6 | Presentation | Data formatting, translation, encryption, and compression. Converts data between application and network formats. | JPEG, MPEG, TLS (partially), ASCII/EBCDIC conversion |
| 5 | Session | Establishes, manages, and terminates sessions between applications. Provides dialog control (half‑duplex/full‑duplex) and synchronization (checkpoints). | NetBIOS, RPC (partially), SIP (session control) |
| 4 | Transport | End‑to‑end communication, segmentation, error recovery, flow control, multiplexing. | TCP, UDP |
| 3 | Network | Routing, addressing, forwarding of packets across multiple networks. | IP, IPX, AppleTalk |
| 2 | Data Link | Node‑to‑node delivery, framing, error detection, media access control (MAC). | Ethernet, Wi‑Fi, PPP, HDLC |
| 1 | Physical | Bit transmission, signal encoding, physical interface characteristics. | Ethernet PHY, 802.11 PHY, RS‑232 |
The OSI model includes Presentation and Session layers, which in the Internet stack are handled by the Application layer (e.g., TLS for encryption, cookies or application‑level sessions).
| Aspect | Internet Stack (TCP/IP) | OSI Model |
|---|---|---|
| Number of layers | 5 | 7 |
| Origin | Practical, from ARPANET and DARPA | Theoretical, from ISO |
| Adoption | Widely implemented and used | Primarily conceptual, not widely implemented |
| Presentation layer | Functionality within Application layer | Separate layer |
| Session layer | Functionality within Application layer and TCP | Separate layer |
| Connection model | Supports both connectionless (UDP) and connection‑oriented (TCP) | Connection‑oriented model |
| Protocol suite | TCP/IP suite | OSI protocols (rarely used; e.g., X.400, X.500) |
| Service model | Best‑effort at network layer, reliable at transport (TCP) | Variety of service models |
Encapsulation is the process of adding headers (and sometimes trailers) as data passes down the layers. Decapsulation is the reverse process at the receiver.
Example: Sending an HTTP request
At the receiver, each layer strips its corresponding header and passes the payload up.
The Internet architecture is often represented as an hourglass: the wide top is applications (HTTP, SMTP, etc.), the narrow waist is IP (the common protocol), and the wide bottom is the diverse link‑layer technologies (Ethernet, Wi‑Fi, fibre, etc.). This design allows many different applications to run over IP, and IP to run over many different link technologies, enabling interoperability and innovation.
The end‑to‑end principle (Saltzer, Reed, Clark, 1984) states that functions should be implemented at the communication endpoints whenever possible, rather than in the network core. The Internet follows this by keeping the core simple (best‑effort IP) and placing reliability, security, and other functions at the endpoints (TCP, TLS). This enables rapid innovation at the application layer without changing the core.
Q1: What are the five layers of the Internet protocol stack, in order from top to bottom?
Application, Transport, Network, Link, Physical.
Q2: What is the primary function of the transport layer?
End‑to‑end communication between processes, including segmentation, error control, flow control, and congestion control (in TCP).
Q3: Name three protocols at the application layer and their uses.
HTTP (web browsing), SMTP (email sending), DNS (domain name resolution). Other examples: FTP, SSH, DHCP.
Q4: What is the difference between TCP and UDP?
TCP is connection‑oriented, reliable, ordered, with flow and congestion control. UDP is connectionless, unreliable, and has no flow or congestion control.
Q5: What are the seven layers of the OSI reference model?
Application, Presentation, Session, Transport, Network, Data Link, Physical.
Q6: What is the purpose of the presentation layer in the OSI model?
Data formatting, translation, encryption/decryption, and compression/decompression.
Q7: How does the Internet stack handle the functions of the OSI presentation layer?
It handles them at the application layer, with protocols like TLS providing encryption and application‑specific formatting (e.g., JSON, XML).
Q8: What is the difference between routing and forwarding?
Routing is the process of determining the end‑to‑end path (using routing protocols). Forwarding is the per‑hop action of moving a packet from an input port to the appropriate output port at a router.
Q9: What is the purpose of the data link layer?
It moves frames from one node to the next on the same link, handling framing, error detection (CRC), and media access control (MAC).
Q10: Why is the Internet protocol stack sometimes called the TCP/IP model?
Because TCP (Transport) and IP (Network) are the two most important and defining protocols of the Internet stack.
Q11: What is the hourglass model of the Internet architecture?
It describes the Internet stack with IP at its narrow waist, allowing many applications above and many link technologies below, enabling interoperability and innovation.
Q12: What is the end‑to‑end principle and how does it relate to the Internet's architecture?
The end‑to‑end principle states that functions should be implemented at the endpoints whenever possible, not in the network core. The Internet follows this by keeping the core simple (best‑effort IP) and placing reliability (TCP) and security (TLS) at the endpoints.
Exercise 1 – Layer identification
For each of the following functions, identify the corresponding layer in the Internet stack and the OSI model: (a) error detection using CRC, (b) routing, (c) encryption, (d) session establishment, (e) bit transmission.
(a) Link layer (Internet) / Data Link (OSI). (b) Network layer / Network. (c) Application layer (Internet) / Presentation (OSI). (d) Application layer (Internet) / Session (OSI). (e) Physical layer / Physical.
Exercise 2 – Encapsulation diagram
Draw a detailed encapsulation diagram for a DNS query (UDP) from a client to a DNS server. Show the headers at each layer and the resulting PDUs.
Exercise 3 – Compare models
Why does the Internet stack not have a separate presentation layer? What are the trade‑offs?
The Internet stack combines presentation functions into the application layer (e.g., TLS, JSON, XML). This simplifies the stack but puts more responsibility on applications. Trade‑off: less standardisation but more flexibility and efficiency.
Exercise 4 – Header fields
Explain the purpose of the following TCP header fields: Sequence Number, Acknowledgment Number, Flags, Window Size.
Sequence Number: orders bytes for reassembly and reliability. Acknowledgment Number: confirms received bytes. Flags: control connection (SYN, ACK, FIN, etc.). Window Size: flow control – tells sender how much data can be sent.
Exercise 5 – Service primitives
Map the TCP socket API calls (socket, bind, listen, accept, connect, send, recv, close) to the OSI service primitives (Request, Indication, Response, Confirm).
connect() → Request/Confirm; accept() → Indication/Response; send/recv → data transfer primitives; close() → Request/Confirm.
Exercise 6 – Hourglass model
Explain how the hourglass model enables the Internet to support new applications without changing the core.
Because IP provides a minimal, universal service, new applications can be built on top using TCP/UDP without modifying routers. For example, HTTP/3 uses QUIC over UDP, but IP remains unchanged.
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 – IPv6 benefits
List the main differences between IPv4 and IPv6 headers. What are the benefits of IPv6?
IPv6 has larger addresses (128-bit), simplified header (no checksum, no fragmentation), flow label, and built-in security (IPsec).
Homework 3 – MAC vs IP
Explain the relationship between MAC addresses and IP addresses. Which layers do they belong to and why are both needed?
MAC addresses are link-layer (Layer 2) and used for local delivery; IP addresses are network-layer (Layer 3) and used for end‑to‑end routing.
Homework 4 – TLS and OSI
In which OSI layer does TLS (Transport Layer Security) operate? Justify your answer. How does this relate to the Internet stack?
TLS operates between the application and transport layers, often considered part of the presentation or session layer in OSI; in the Internet stack it is an application-layer protocol.
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 provided a detailed examination of the Internet protocol stack and the OSI reference model:
Understanding both models is essential for network professionals. The Internet stack provides the practical implementation, while the OSI model offers a valuable conceptual framework. In the next tutorial, we will explore the World Wide Web and web technologies.