Networks

icon picker
OSI and TCP/IP

OSI Model vs. TCP/IP Model

Comparison Table
OSI Model (7 Layers)
TCP/IP Model (4 Layers)
Mnemonic for OSI Model
Mnemonic for TCP Model
1
7. Application (HTTP, FTP, SMTP)
4. Application (HTTP, FTP, SMTP)
All People Seem To Need Data Processing
A Tired Network Intern
2
6. Presentation (Data encryption, compression)
(Merged in TCP/IP Application)
3
5. Session (Establish, manage sessions)
(Merged in TCP/IP Application)
4
4. Transport (TCP, UDP)
3. Transport (TCP, UDP)
5
3. Network (IP, routing)
2. Internet (IP, ICMP)
6
2. Data Link (Ethernet, MAC addresses)
1. Network Interface (Ethernet, ARP)
7
1. Physical (Cables, switches, binary transmission)
(Part of Network Interface)
There are no rows in this table

Mnemonics
OSI Model: "All People Seem To Need Data Processing"
Application
Presentation
Session
Transport
Network
Data Link
Physical
TCP/IP Model: "A Tired Network Intern"
Application
Transport
Network (Internet)
Interface (Network Interface)

Example: Sending an Email

Let's consider a scenario where a user sends an email from their email client (like Microsoft Outlook or Gmail) to a recipient. We will go through the steps to show how the data moves through the layers of both the OSI and TCP/IP models.

Step-by-Step Process Through the OSI Model

Application Layer (OSI Layer 7) / Application Layer (TCP/IP Layer 4):
Example: The user writes an email and clicks "Send" in the email client.
The email client (application) uses a protocol such as SMTP (Simple Mail Transfer Protocol) to prepare the email for sending.
Real World: The email client, such as Outlook or Gmail, prepares the email data and uses SMTP to format it for sending.
Presentation Layer (OSI Layer 6):
Example: If the email is sent securely (using TLS encryption), the Presentation layer encrypts the email data.
Real World: The email content is encrypted for security during transmission, ensuring it cannot be read by unauthorized parties.
Note: In the TCP/IP model, this step is handled within the Application layer.
Session Layer (OSI Layer 5):
Example: The Session layer establishes, manages, and terminates the session between the user’s email client and the recipient’s email server.
Real World: A session is created between the sender’s email client and the mail server to ensure the connection remains open until the email is fully sent.
Note: In the TCP/IP model, this is also handled within the Application layer.
Transport Layer (OSI Layer 4) / Transport Layer (TCP/IP Layer 3):
Example: The Transport layer uses TCP (Transmission Control Protocol) to ensure reliable transmission. It breaks down the email into smaller packets and numbers them to ensure they are reassembled correctly at the destination.
Real World: TCP ensures the email data is sent reliably. If any packets are lost during transmission, TCP will retransmit them.
Network Layer (OSI Layer 3) / Internet Layer (TCP/IP Layer 2):
Example: The Network layer adds IP addresses (sender’s and recipient’s email servers) to the packets and determines the best route for the data to travel across networks.
Real World: The email data is routed from the sender's network through various routers on the Internet to reach the recipient’s email server.
Data Link Layer (OSI Layer 2) / Network Interface Layer (TCP/IP Layer 1):
Example: The Data Link layer adds physical addresses (MAC addresses) to the packets and prepares them for transmission over the local network.
Real World: The data frames containing the email packets are sent over the Ethernet network to the router, which then forwards them towards the recipient’s server.
Physical Layer (OSI Layer 1):
Example: The Physical layer converts the frames into electrical signals or radio waves to transmit them over the physical medium (like an Ethernet cable or Wi-Fi).
Real World: The email data travels as electrical signals through an Ethernet cable or as radio waves over Wi-Fi to reach the nearest router or network device.
Note: In the TCP/IP model, the Physical and Data Link layers are combined into the Network Interface layer.

Real-World Scenario: Web Browsing

Now, let’s look at another real-world example: browsing a webpage using the TCP/IP model.
Scenario: A user wants to visit www.example.com from their web browser (e.g., Google Chrome).
Application Layer (TCP/IP Layer 4):
Example: The user enters www.example.com in the browser’s address bar and hits enter.
The browser sends an HTTP GET request to retrieve the webpage.
Real World: The browser (e.g., Chrome, Firefox) initiates an HTTP request to the server hosting www.example.com.
Transport Layer (TCP/IP Layer 3):
Example: The HTTP request is encapsulated in a TCP segment.
TCP ensures reliable delivery by establishing a connection with the server using the three-way handshake process (SYN, SYN-ACK, ACK).
Real World: The user's computer sends a request to establish a connection to the server. TCP ensures that all parts of the webpage are received correctly and in order.
Internet Layer (TCP/IP Layer 2):
Example: The TCP segment is encapsulated in an IP packet.
The IP packet contains the IP addresses of the sender (user’s computer) and the receiver (web server for www.example.com).
Real World: The IP packet is routed through various networks (ISPs, routers) to reach the destination server.
Network Interface Layer (TCP/IP Layer 1):
Example: The IP packet is encapsulated in a frame suitable for the network interface (e.g., Ethernet or Wi-Fi).
The frame is transmitted over the physical medium (cable, fiber optics, wireless signal).
Real World: The frame is sent from the user's computer, over the local network, to the router, and then through the ISP’s network infrastructure towards the destination.
Response from the Server:
The server hosting www.example.com receives the HTTP request and processes it.
The server sends back the requested webpage data following the same layer-by-layer process in reverse order, from Network Interface back up to Application.
The user’s browser receives the data, reconstructs the webpage, and displays it to the user.

Key Takeaways

OSI Model: Provides a theoretical framework with seven layers, each handling specific aspects of network communication.
TCP/IP Model: A practical, protocol-driven model with four layers, commonly used in real-world internet communications.
Process: SYN—→SYN,ACK—→ ACK
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.