// FORMAL OBJECTIVES
- Understand the OSI model.
- Understand why it is used in computer networking.
- Identify every layer and its boundary responsibilities.
Layer 7 · Application
The layer with which users and applications interact directly, acting as the interface between end software and the network. It enables network services such as:
Core Protocols and How They Work:
| Protocol | Port(s) | Formal Definition |
|---|---|---|
| HTTP | 80, 8080 | Enables client–server hypertext communication over ports 80 and 8080. |
| HTTPS | 443 | The secure version of HTTP, adding a TLS cryptographic and authentication layer over port 443. |
| FTP | 20, 21 | Provides bidirectional file transfer—sending and receiving files across ports 20 and 21. |
| DNS | 53 | Translates domain names into public IP addresses over port 53. |
| SMTP | 25, 587, 465 | Handles mail submission and relay transmission over ports 25, 587, and 465. |
| SSH | 22, 2222 | Provides encrypted remote server login, command execution, and file transfer over port 22 or 2222. |
What specific job does each of these protocols perform?
• HTTP/HTTPS: Govern web exchanges via request–response methods (GET, POST, PUT, DELETE). HTTPS wraps transport in TLS/SSL to thwart Man-in-the-Middle (MitM) interception.
• FTP: Uses two separate connections: port 21 for control commands and port 20 for the actual data stream.
• DNS: The Internet's directory, resolving human-readable names into 32-bit or 128-bit IP addresses needed by Layer-3 routers.
• SMTP: Store-and-forward mail relay protocol. Port 25 handles server-to-server transfers (MTA), while port 587 with STARTTLS serves mail clients (MUA).
• SSH: Secure replacement for Telnet. Authenticates via cryptographic key pairs and runs an encrypted interactive shell session.
Layer 6 · Presentation
Ensures exchanged payloads can be understood by both endpoints and protects their confidentiality.
Layer 5 · Session
Establishes, coordinates, and closes dialogue connections between communicating systems. Each connection is termed a session and is unique and unambiguous. Session control—such as temporary turn-taking governance—is also managed here.
For half-duplex or orderly exchanges, Layer 5 assigns tokens to coordinate turns and keep multi-step dialogues uninterrupted.
Formal Token Mechanisms:
Digital key indicating which data stream may be transmitted and when transmission is permitted.
Governs speaking turns over half-duplex links to avoid dialogue collisions.
Partitions a session into distinct activities; if one activity is interrupted or deferred, it can resume cleanly later.
Isolates complex logical work units without restarting the entire session.
Synchronises client and server state using numbered temporal markers.
Inserts checkpoints during transfers to enable crash recovery without retransmission from scratch.
Terminates the session cleanly by negotiating closure of the communication channel.
Ensures orderly teardown and buffer deallocation on both peers.
Layer 4 · Transport
Delivers reliable end-to-end host communication across a network. It receives payloads from the Session layer (Layer 5) and passes segmented units to the Network layer (Layer 3), splitting or sizing segments into smaller or larger units as transport limits require.
Two transport protocols dominate production networks:
Transmits data sequentially, numbering segments and confirming ordered delivery.
Lower-latency transmission without ordering checks or delivery acknowledgements.
Services Provided by the Transport Layer:
Supported by protocols like TCP (Transmission Control Protocol), which assigns port numbers in the range 0 to 65,535 and enforces acknowledgement handshakes.
Skip delivery acknowledgements and session setup. Despite omitting retry overhead, they excel for real-time streams like voice and videoconferencing. UDP (User Datagram Protocol) likewise uses ports between 0 and 65,535.
Guarantees segments are reassembled in exact send sequence by assigning monotonically tracked sequence numbers.
Detects corrupted, dropped, or out-of-order segments via checksums and issues acknowledgements (ACKs) back to the sender to verify payload integrity.
Throttles or expands transmission windows dynamically (sliding window advertisement) to avoid overwhelming a slower receiver's buffers.
When intermediate routers or links bottleneck, the transport layer scales back send rates (cwnd back-off) to prevent sustained network collapse.
Interleaves packets from many concurrent applications over one network link using unique source/destination port tuples.
Layer 3 · Network
Determines the logical path data travels across interconnected networks, handling logical addressing, routing computation, and packet forwarding.
Devices such as routers operate here using routing algorithms and forwarding tables to guide packets across complex internetworks via protocols such as:
| Protocol | Formal Definition |
|---|---|
| IP | Internet Protocol—unique numerical logical identifier for an interface across networks, operating via IPv4 or IPv6. |
| ICMP | Internet Control Message Protocol—transmits error notifications and diagnostic telemetry (ping / traceroute). |
| IPSec | IP Security—provides network-layer authentication and encryption for IP packets. |
Layer 2 · Data Link
Provides reliable node-to-node transfer across a single local link. Organises raw bits into frames, handles local error detection, and arbitrates orderly media access through two sublayers:
Bridges upper Network-layer protocols with the hardware-facing MAC sublayer.
Interfaces directly with NIC hardware and manages frame encapsulation and physical addressing.
Layer 1 · Physical
Forms the foundation of the OSI stack, transmitting raw binary streams (1s and 0s) over copper cabling, optical fibre, or wireless radio spectrum. Defines electrical, mechanical, and procedural specifications to activate and maintain physical links.
Key standards and technologies: physical Ethernet specifications, RS-232, DSL, SONET, and Bluetooth.
Hardware components: hubs, cables, repeaters, connectors, and transceivers operate here, governing line rate, signal attenuation, and medium integrity.
Returning to the WhatsApp Example: What Happens When You Send a Message?
Layer-by-layer traceability:
| OSI Layer | Technical Action in WhatsApp |
|---|---|
| Application | The user types "Hello" in WhatsApp; the client app parses the event and prepares Internet delivery. |
| Presentation | The message is encoded into binary bytes and encrypted (end-to-end encryption in WhatsApp). |
| Session | An active authenticated session between peers is verified and kept coherent throughout delivery. |
| Transport | Payloads are split into segments and assigned TCP (reliable text/control) or UDP (low-latency voice/video) depending on data type. |
| Network | Source and destination IP addresses are attached, routing paths are selected, and each segment becomes an IP packet. |
| Data Link | Next-hop MAC addresses are prepended, payloads are wrapped into frames, and local link errors are detected. |
| Physical | Bits are modulated into electrical voltages, optical pulses, or radio waves (Wi-Fi / cellular). |
