1. The OSI Model (Open Systems Interconnection)

Theoretical Model (7 Layers)
Helps to understand the process. Data moves from top to bottom on the sender side and bottom to top on the receiver side.

Layer

Name

Function (What happens here?)

Data Unit

Device/Protocol Example

7

Application

Network to Software (User interface). HTTP, FTP, SMTP.

Data

Web Browsers, Outlook

6

Presentation

Translation, Encryption/Decryption, Compression. (Makes data presentable to the Application layer).

Data

SSL/TSL (Encryption), JPEG, GIF

5

Session

Managing sessions. Establishes, maintains, and terminates connections between applications.

Data

NetBIOS, RPC

4

Transport

End-to-End connection, Reliability. Decides how to send data. Segmentation.

Segment

TCP (Reliable), UDP (Fast)

3

Network

Logical Addressing & Routing. Finds the best path to the destination. Adds IP addresses.

Packet

IP (IPv4/IPv6) , Routers

2

Data Link

Physical Addressing (MAC). Error-free transfer of frames from one node to another.

Frame

MAC Address , Switches, Bridges

1

Physical

Hardware. Cables, bits, voltage, hubs.

Bits

Hubs, Cables, NIC

Mnemonic to Remember (Top to Bottom): All People Seem To Need Data Processing.

Diagram

2. The TCP/IP Model (The Practical Model)

This is what the internet actually uses. It is a condensed version of the OSI model.

TCP/IP Layer

Equivalent OSI Layers

Protocols

4. Application

OSI 5, 6, 7 (Session, Presentation, Application)

HTTP, HTTPS, FTP, SMTP, DNS, DHCP

3. Transport

OSI 4 (Transport)

TCP , UDP

2. Internet

OSI 3 (Network)

IP , ICMP, ARP

1. Network Access

OSI 1, 2 (Physical, Data Link)

Ethernet, Wi-Fi (802.11), Fiber


3. Key Protocols (The Rules of Communication)

A. Application Layer Protocols

  • HTTP (Port 80): Used for web pages (unsecured).

  • HTTPS (Port 443): HTTP + SSL/TLS (Secured, encrypted).

  • FTP (Port 20/21): File Transfer Protocol. (20 for data, 21 for control).

  • SMTP (Port 25): Simple Mail Transfer Protocol. Used for sending mail.

  • POP3 (Port 110): Post Office Protocol. Used for receiving mail (downloads mail).

  • IMAP (Port 143): Internet Message Access Protocol. Used for receiving mail (syncs mail, keeps on server).

  • DNS (Port 53): Domain Name System. Converts google.com to 8.8.8.8.

  • DHCP (Port 67/68): Dynamically assigns IP addresses to devices on a network.

B. Transport Layer Protocols

  • TCP (Transmission Control Protocol):

    • Connection-oriented: Establishes a connection before sending (Three-way handshake).

    • Reliable: Acknowledges receipt of data. If data is lost, it resends it.

    • Use Cases: Browsing web, emails, file transfer (cannot afford data loss).

    • Overhead: Slow due to error checking.

  • UDP (User Datagram Protocol):

    • Connectionless: Just sends the data (fire and forget).

    • Unreliable: No acknowledgment. If data is lost, it's gone.

    • Use Cases: Video Streaming, VoIP (Zoom calls), Online Gaming (Speed is more important than a few lost pixels/packets).

Overhead: Very fast.

C. Internet Layer Protocols

  • IP (Internet Protocol): Responsible for addressing (IP Addresses).

  • ICMP: Used for error reporting and testing (e.g., the ping command).

  • ARP (Address Resolution Protocol): Finds the MAC address of a device with a specific IP address. (IP -> MAC).


4. Important Port Numbers (The "Doors")

A port is a logical endpoint for communication. It tells the computer which application the data belongs to.

Port Number

Protocol

Used By

20/21

TCP

FTP (File Transfer)

22

TCP

SSH (Secure Shell - Remote Login)

23

TCP

Telnet (Insecure Remote Login)

25

TCP

SMTP (Sending Email)

53

TCP/UDP

DNS (Domain Name Service)

67/68

UDP

DHCP (Dynamic IP assignment)

80

TCP

HTTP (Web)

110

TCP

POP3 (Receiving Email)

143

TCP

IMAP (Receiving Email)

443

TCP

HTTPS (Secure Web)

3389

TCP

RDP (Remote Desktop)


5. Addressing: MAC vs. IP

Feature

MAC Address (Physical)

IP Address (Logical)

Full Form

Media Access Control

Internet Protocol

Layer

Layer 2 (Data Link)

Layer 3 (Network)

Size

48 bits (6 octets) e.g., 00:1A:2B:3C:4D:5E

32 bits (IPv4) or 128 bits (IPv6)

Nature

Hard-coded into the NIC by manufacturer.

Dynamic/Static assigned by network admin/DHCP.

Analogy

Your Name (You are born with it).

Your Address (It changes when you move).


6. How They Work Together: The Encapsulation Process

When you type www.google.com in your browser, this is what happens:

  1. Data (Application Layer): You type the URL. The browser prepares an HTTP GET request.

  2. Segments (Transport Layer): TCP breaks this data into small chunks (Segments), adds a sequence number, and specifies the Port (80) .

  3. Packets (Internet Layer): The IP protocol wraps the segment into a Packet. It adds the Source IP (your computer) and Destination IP (Google's server).

  4. Frames (Data Link Layer): The packet is wrapped into a Frame. It adds the Source MAC and the Next Hop's MAC (usually your router/gateway).

  5. Bits (Physical Layer): The frame is turned into 1s and 0s (electricity or light) and sent down the wire.