The OSI Model is a system that breaks network communication into 7 layers, each with a
specific role. It ensures that data moves smoothly from one device to another.
The 7 Layers of the OSI Model:
1. Physical Layer: Transmits raw signals (like electrical pulses or light) over cables or
wireless.
2. Data Link Layer: Makes sure data travels without errors on a local network.
3. Network Layer: Decides the best path to send data between devices using IP addresses.
4. Transport Layer: Splits data into smaller pieces and ensures they arrive correctly.
5. Session Layer: Keeps track of the connection between two devices during
communication.
6. Presentation Layer: Prepares the data for the application, handling encryption and
formatting.
7. Application Layer: Directly interacts with users through software (like email or web
browsers).
Example: Sending an Email (Alice to Bob)
Scenario: Alice sends an email to Bob.
On Alice's Side (Sender):
1. Application Layer: Alice writes an email in her email app.
The app uses the SMTP protocol to prepare the email.
2. Presentation Layer: The email is converted into a format
that can be sent over the network and encrypted for security.
3. Session Layer: A connection is created between Alice's
device and her email server.
4. Transport Layer: The email is broken into smaller pieces
(called segments). TCP ensures they are numbered
correctly for reassembly.
5. Network Layer: Each segment is packed into a packet
with Alice's and Bob's IP addresses to route it across networks.
6. Data Link Layer: The packet is added to a frame with
hardware addresses (MAC addresses) for local delivery.
7. Physical Layer: The frame is converted into signals
(electricity, light, or radio waves) and sent over the network.
On Bob's Side (Receiver):
1. Physical Layer: Bob's device receives the
signals and passes them to the next layer.
2. Data Link Layer: Frames are checked for errors
and unpacked to extract packets.
3. Network Layer: Bob's device confirms the
packet is for him (via the IP address) and
forwards it.
4. Transport Layer: Segments are reassembled
into the original email.
5. Session Layer: The connection between Alice's
and Bob's devices remains open until the email
is fully received.
6. Presentation Layer: The email is decrypted and
formatted so it's readable.
7. Application Layer: Bob's email app (Gmail,
Outlook) displays the email for him to read.
Feature Simplex Half Duplex Full Duplex
Two-way (one
Direction One-way only Two-way (simultaneous)
at a time)
Bidirectional
Communication Unidirectional Bidirectional (at the same time)
(not at once)
Keyboard, Monitor, TV
Walkie-talkie, Telephone, smartphone, Video Call,
Example Devices broadcast, Printer, GPS
CB Radio Fiber optic communication
receiver, Fire alarm system
Slower (due to
Transmission Speed Fast (one way) Fast (continuous two-way)
switching)
Cost Low Medium High
Collision Chance None Possible None (with separate channels)
Complexity Simple Moderate Complex
TCP/IP vs OSI
What Are the OSI and TCP/IP Models?
• Both are frameworks to understand how computers communicate in a network.
• They break down communication into layers, where each layer has a specific job.
Why Two Models?
• OSI Model: For learning and designing networks.
• TCP/IP Model: For building and running the Internet.
Key Differences (short differences)
Feature OSI Model TCP/IP Model
Purpose A guide to design new Focuses on how the Internet
networks. works.
Number of Layers 7 layers (more detailed). 4 layers (simpler).
Use Mostly for learning and Used in real-world networks.
reference.
Development Made to explain networks Developed for the Internet.
clearly
Key Differences (given by chatgpt)
Feature OSI Model TCP/IP Model
Transmission Control Protocol /
Full Form Open Systems Interconnection
Internet Protocol
ISO (International Organization for DARPA (U.S. Department of
Developed By
Standardization) Defense)
Number of Layers 7 Layers 4 Layers
Application, Presentation, Session,
Application, Transport,
Layers Transport, Network, Data Link,
Internet, Network Access
Physical
Practical implementation
Concept Theoretical model
model
Standardization Generic and protocol-independent Protocol-oriented
Widely used in real-world
Usage Mainly used as a reference model
networking
Transport Layer
TCP, UDP TCP, UDP
Protocols
Network Layer Protocols IP, ICMP, ARP, etc. IP, ICMP, ARP, etc.
More straightforward and
Model Type More descriptive and detailed
simpler
Protocol Definition Protocols are not strictly defined Protocols are well defined
Examples of Application
HTTP, FTP, SMTP, DNS HTTP, FTP, SMTP, DNS
Layer Protocols
Some layers are combined
Mapping Layers are strictly separated (e.g., Application = 3 OSI
layers)
OSI Model (7 layers) TCP/IP Protocol Suite (4 layers)
Physical layer: Wires, cables, signals. Network Access layer: Combines OSI's
Data Link layer: Rules for sending data (e.g., Physical and Data Link layers.
Ethernet).
Network layer: Decides the route (e.g., IP). Internet layer: Decides the route (same as
OSI's Network layer).
Transport layer: Ensures data is sent/received Transport layer: Ensures reliable data transfer
properly (e.g., TCP). (same as OSI's Transport layer).
Session layer: Manages connections Application layer: Combines OSI's Session,
between devices. Presentation, and Application layers.
Presentation layer: Formats data for
understanding (e.g., encryption).
Application layer: Apps like browsers, email
(e.g., HTTP, FTP).
The Application Layer
DNS — Domain Name System
• DNS is used to get IP from the domain name.
SMTP — Simple Mail Transfer Protocol
• SMTP is used by Email Clients like Gmail, Outlook, Yahoo etc.
• SMTP sends email from the sender's device to the receiver's mailbox.
POP — Post Office Protocol
• POP service is also based on emails.
• POP retrieves and organizes emails from the receiver's mail server to the receiver's
computer.
FTP — File Transfer Protocol
• FTP is used for file transfer.
HTTP — Hyper Text Transfer Protocol
• HTTP is used for browsing webpage.
DNS
Here's a short bullet-point summary of the basics of DNS:
Basics of DNS (Domain Name System)
• DNS stands for Domain Name System.
• It translates domain names (like [Link]) into IP addresses (like [Link]).
• Acts like the "phonebook" of the internet.
• Without DNS, users would have to remember IP addresses to visit websites.
• DNS uses a hierarchical structure (root → TLD → domain → subdomain).
• DNS resolution is the process of converting domain names to IPs.
• DNS queries can be recursive or iterative.
• Common DNS record types:
o A – maps domain to IPv4 address.
o AAAA – maps domain to IPv6 address.
o CNAME – alias for another domain name.
o MX – mail server info.
o NS – name server for the domain.
• DNS servers involved in resolution:
o Resolver (your ISP's DNS server)
o Root server
o TLD server (e.g., .com)
o Authoritative name server
• DNS uses UDP port 53 (and sometimes TCP for large queries).
• DNS caching improves speed and reduces traffic.
Email Protocols
Feature SMTP POP3 IMAP
Simple Mail Transfer Internet Message Access
Full Form Post Office Protocol (v3)
Protocol Protocol
Receiving and downloading Receiving and managing
Purpose Sending emails
emails emails
Outgoing mail (client → Incoming mail (server → Incoming mail (server ↔
Direction
server) client) client sync)
Downloads then deletes
Data Storage Doesn’t store emails Emails stay on server
from server
Not used for reading Offline access after Online access (syncs with
Access Type
mail download server)
Device Not good for multiple Excellent for multiple
Not applicable
Syncing devices devices
Port 25 (default), 587 (with 110 (default), 995 143 (default), 993
Numbers TLS) (secure/SSL) (secure/SSL)
Folder
Not applicable No Yes (e.g., Inbox, Sent, Trash)
Support
Used by sender’s mail Basic download-only email Advanced clients like Gmail,
Use Case
server clients Outlook
Sender Mail Server Receiver Mail Server
E.g. IBM Server E.g. I Server
HTTP and HTTPs
Basics of HTTP/HTTPs:
• HTTP is Hypertext Transfer Protocol.
• Port Number for HTTP is 80.
• At the transport Layer, HTTP usually uses TCP for reliable services.
• Server stays stateless. Many clients are connected to the server, so the server can not
maintain the state of each client.
• Client state is maintained using cookies.
• HTTP is in Band protocol. {Command and Data are on the same connection}
Types of HTTP:
HTTP 1.0 {Non-Persistent Connection}
• TCP connection is established for each HTTP request-response transaction.
• After the server sends the response back to the client, the connection is closed.
• If the client needs to make another request, it has to establish a new TCP connection.
• Simple Implementation
• Predictable resource usage
• Increase in overhead
• Higher latency
HTTP 1.1 {Persistent Connection}
• The client and server maintain the connection open after the initial request-response
exchange.
• So, for a new request by the client, no need to establish a new TCP connection.
• Reduced Overhead
• Faster Response Time
File transfer protocol
FTP, SFTP & TFTP are used to transfer files over the computer network.
FTP — File Transfer Protocol (Port Number = 21)
• It has two channels, one is for data and the second is for command. (Out-of-band
protocol)
• It has no encryption, so data tempering is possible.
• It uses TCP for data communication.
SFTP — SSH (Secure Shell) File Transfer Protocol (Port Number = 22)
• It has a single channel for data and command. (In-Band Protocol)
• Both data and command are encrypted in SFTP.
• It uses TCP for data communication.
TFTP — Trivial File Transfer Protocol (Port Number = 69)
• It doesn't require authentication, making it less secure than FTP and SFTP.
• It uses UDP for data communication.
• It is not used over the internet, it is mainly used for transferring files within LAN.
FTP (File Transfer SFTP (SSH File Transfer TFTP (Trivial File
Feature
Protocol) Protocol) Transfer Protocol)
Trivial File Transfer
Full Form File Transfer Protocol SSH File Transfer Protocol
Protocol
Protocol Type Standard TCP-based Secure SSH-based Simplified UDP-based
No encryption Encrypted and secure No encryption or
Security
(plain text) via SSH authentication
Port Number 21 (control), 20 (data) 22 69
Username/password or Optional (often
Authentication Username & password
SSH keys anonymous)
Data Transfer Separate control and Encrypted over single SSH Simple send/receive
Method data channels channel operations
Slightly slower (due to Fast (no security
Speed Moderate
encryption) overhead)
Usage Complexity Moderate Higher (needs SSH setup) Very simple
Low (uses UDP, no error
Reliability High (with TCP) High (with TCP)
correction)
Common Use Website management, Secure file transfers, Firmware upgrades,
Cases file hosting server admin network booting