The TCP/IP and OSI model - Day 4

Introduction to Network Models
Imagine Maria, sitting at her desk in New York, wanting to check the flight status for her friend's arrival in Tokyo. With a few clicks, she opens her browser and navigates to the airline's website. This seemingly simple action triggers an intricate sequence of events across the digital landscape, navigating through layers of network protocols before returning with the information she needs.
Computer networks rely on standardized frameworks to facilitate this type of communication. Two primary models exist: the practical TCP/IP model and the theoretical OSI model. These frameworks are like the postal service of the digital world, ensuring Maria's request reaches the correct destination and that she receives the proper response.
Layer Comparison between TCP/IP and OSI
The TCP/IP model consists of five layers:
Physical Layer (1): Handles the transmission of raw bit streams over a physical medium. This includes electrical specifications, cables, connectors, and signaling methods. For Maria, this is where her laptop's network card converts her request into electrical signals that travel through her home's Ethernet cable or Wi-Fi radio waves.
Data Link Layer (2): Provides reliable transmission of data frames between two nodes connected by a physical layer. It handles error detection, addressing (MAC addresses), and media access control. Here, Maria's request gets an address label similar to an envelope with a local delivery code.
Network Layer (3): Manages addressing, routing, and packet forwarding between networks. The Internet Protocol (IP) operates at this layer, handling logical addressing and path determination. Maria's request now acquires long-distance addressing—like adding a country and city to her envelope—allowing it to navigate across the global internet toward Japan.
Transport Layer (4): Ensures complete data transfer by providing end-to-end communication services. TCP (connection-oriented, reliable) and UDP (connectionless, unreliable) protocols operate here, managing port numbers, segmentation, and flow control. This layer ensures Maria's request arrives completely intact, similar to how a registered mail service tracks packages and confirms delivery.
Application Layer (5): Provides network services directly to end-users or applications. In TCP/IP, this combines the functions of the upper three OSI layers (Session, Presentation, and Application). This is where Maria's browser formats her request in ways the airline server will understand.
Meanwhile, the OSI model features seven layers:
Physical Layer (1): Identical to TCP/IP's Physical layer, managing hardware connections and raw data transmission.
Data Link Layer (2): Similar to TCP/IP's Data Link layer, handling frame-based transmission and MAC addressing.
Network Layer (3): Equivalent to TCP/IP's Network layer, managing logical addressing and routing.
Transport Layer (4): Corresponds to TCP/IP's Transport layer, providing end-to-end communication control.
Session Layer (5): Establishes, manages, and terminates connections between applications, not explicitly defined in TCP/IP. For Maria, this layer manages the ongoing conversation between her browser and the airline's server.
Presentation Layer (6): Handles data translation, encryption, and formatting, also not explicitly defined in TCP/IP. This ensures the flight information appears correctly on Maria's screen regardless of what type of device she's using.
Application Layer (7): Provides network services to end-user applications, similar to TCP/IP's Application layer but more narrowly defined. This is where Maria's browser displays the flight information in a user-friendly format.
Network professionals commonly use the mnemonic "Please Do Not Throw Sausage Pizza Away" to remember these seven layers.
Practical Implementation
While TCP/IP is more commonly implemented in real-world applications, discussions about networking typically reference the OSI model's seven-layer structure. This creates a practical hybrid approach where data transfers through TCP/IP's five layers, but professionals conceptualize them within OSI's seven-layer framework.
In Maria's case, her flight status request actually travels through the TCP/IP model's implementation, but network engineers troubleshooting any connection issues would discuss problems in terms of which OSI layer is affected.
Session and Presentation Layers
In the OSI model, two additional layers exist between the Transport and Application layers:
Session Layer (5)
The Session layer establishes, manages, and terminates connections between applications. Its key functions include:
Dialog control (determining which device can transmit and when)
Session establishment, maintenance, and termination
Synchronization (establishing checkpoints during data transfer)
Managing session recovery after failures
Supporting both simplex, half-duplex, and full-duplex operation modes
For Maria's flight check, this layer maintains the connection between her browser and the airline server throughout her session, even as she navigates to different pages to check additional flight details, baggage policies, or terminal information.
Presentation Layer (6)
The Presentation layer prepares data for the Application layer by transforming it into a format that application-level processes can understand. Key functions include:
Data translation and formatting
Encryption and decryption
Compression and decompression
Character set conversion (ASCII, EBCDIC, etc.)
Managing file formats (JPEG, TIFF, GIF, etc.)
Abstracting syntax differences between communicating systems
This layer ensures that when Maria receives flight information that includes the airline's logo, flight status indicators, or maps, these elements are correctly formatted and displayed on her screen regardless of her device or operating system.
Data Encapsulation Process
When data travels from one system to another, it follows a specific encapsulation process, with the data unit having different names at each layer:
Initial Connectivity: ARP packets identify the data transfer path, and DNS servers resolve the actual IP address of the destination. When Maria types "tokyoairlines.com" in her browser, DNS servers first translate this name into the actual IP address of the airline's web server.
Application Layer (7/5): The data begins its journey at this layer as data or messages. Maria's request for flight JL123's status is prepared for transmission using HTTP or HTTPS protocols.
Presentation Layer (6): In the OSI model, the data is formatted, possibly compressed, and/or encrypted for standardized transmission. Maria's request might be encrypted if using HTTPS, protecting her session information.
Session Layer (5): The OSI model establishes a session between the communicating applications. The data maintains its form while a unique session identifier is created for Maria's interaction with the airline website.
Transport Layer (4): Data receives a header containing port information (port 80 for HTTP or 443 for HTTPS), creating a segment (TCP) or datagram (UDP). This is like specifying which department at Tokyo Airlines should receive Maria's request.
TCP 3-Way Handshake
Before Maria's flight status request data can be transmitted, her computer and the airline server must establish a reliable connection. This happens through the TCP 3-way handshake:
SYN (Synchronize): Maria's computer sends a segment with the SYN flag set and an initial sequence number (ISN). This is like Maria saying, "Hello, Tokyo Airlines! I'd like to start a conversation with reference number 1000."
SYN-ACK (Synchronize-Acknowledge): The airline server responds with a segment containing both the SYN and ACK flags, acknowledging Maria's sequence number and providing its own ISN. This is like the airline responding, "Hello Maria! I received your message #1000, and I'm responding with my reference number 2000."
ACK (Acknowledge): Maria's computer sends a segment with the ACK flag set, acknowledging the server's sequence number. This completes the connection establishment. It's like Maria saying, "Great! I confirm receipt of your message #2000. Now we can talk about my flight status request."
Only after this handshake is complete can Maria's actual flight status request be transmitted. This process ensures reliable, ordered delivery of data and is why TCP is considered a connection-oriented protocol.
TCP vs UDP
While Maria's flight status check uses TCP for reliability, her friend Raj is simultaneously streaming the airline's promotional video. His application is using UDP instead:
TCP (Transmission Control Protocol):
Connection-oriented: Establishes a connection before data transfer
Reliable: Guarantees delivery through acknowledgments and retransmission
Ordered: Maintains sequence of packets
Flow control: Prevents overwhelming receivers with too much data
Error detection: Checks for corrupted packets
Examples: Web browsing (HTTP/HTTPS), email (SMTP), file transfers (FTP)
UDP (User Datagram Protocol):
Connectionless: No handshake, just sends data immediately
Unreliable: No guarantee of delivery or order
Lightweight: Minimal header overhead (8 bytes vs TCP's 20+ bytes)
Faster: No connection establishment, acknowledgments, or retransmission
No congestion control: Will not slow down when network is busy
Real-World UDP Applications:
Live Streaming: When Raj watches the airline's promotional video, occasional dropped frames are preferable to buffering delays.
Online Gaming: When Maria's son plays multiplayer games, the quick response is more important than perfect data delivery.
VoIP Calls: During Maria's call to confirm her friend's arrival details, brief audio glitches are acceptable but conversation delays are not.
DNS Lookups: When resolving "tokyoairlines.com" to an IP address, speed matters most.
IoT Devices: Maria's smart home sensors send frequent but non-critical updates using UDP.
DHCP: When Maria's laptop first connects to the airport Wi-Fi, it uses UDP to quickly obtain an IP address.
UDP is ideal for time-sensitive applications where losing some data is preferable to waiting for retransmissions. If Maria were video-chatting with her friend about the flight status, the application would likely use UDP for the video/audio and TCP for chat messages and control signals.
Network Layer (3): The segment acquires a header with source and destination IP addresses, forming a packet. Now Maria's message has both her return address and the airline server's address.
Data Link Layer (2): Adds header and trailer with MAC addresses, creating a frame. This adds the specific information needed to get Maria's request to the first stop on its journey, her local internet gateway.
Physical Layer (1): Converts information into bits represented as signals (electrical, optical, or radio) for transmission over the physical medium. Maria's request leaves her laptop as electrical signals through her router.
Data Transmission Path
Maria's flight status request now travels through the network following a specific path:
Source Device: The request originates from Maria's laptop in New York and passes down through all layers of the protocol stack, with each layer adding its header information. By the time it leaves her device, the original data has been transformed into bits within a frame.
LAN Infrastructure: The frame travels from Maria's laptop to her home's Wi-Fi router, which forwards it based on MAC addresses.
Router: The router strips the frame to access the packet, examines the IP addresses, determines the best route, and forwards it toward Tokyo Airlines' servers.
Internet/WAN: The packet traverses multiple routers across different networks spanning continents, with each router making independent forwarding decisions to move Maria's request closer to its destination in Japan.
Destination Network: Upon reaching Tokyo Airlines' network, the packet is delivered to the appropriate server based on routing information.
Destination Device: The frame arrives at the airline's web server, which processes it upward through the protocol stack, removing each layer's header. The process reverses:
- Frame → Packet → Segment → Data
The original flight status request reaches the web application, which queries its database and prepares a response showing that flight JL123 is "On Time."
The response then follows the same process in reverse, beginning at the application layer of the airline's server and working down through encapsulation, across the internet, and up through the protocol layers of Maria's laptop, until finally, her browser displays "Flight JL123: On Time" on her screen.
This process occurs bidirectionally, allowing for request-response communication between systems. At each step, the networking devices operate only at their relevant layers: switches primarily at Layer 2, routers at Layer 3, and end devices across all layers.



