OSI and TCP/IP Models Explained
OSI and TCP/IP Models Explained
Protocols &
Layer Name Function Data Unit
Devices
Provides a user interface and network services for HTTP, FTP, SMTP,
7 Application Data
applications. DNS
Handles data formatting, encryption, decryption,
SSL, TLS, JPEG,
6 Presentation and compression. Ensures data is readable by the Data
MPEG
receiving application.
Establishes, manages, and terminates connections
5 Session Data NetBIOS, RPC
(sessions) between applications.
Provides end-to-end communication services.
4 Transport Handles segmentation, reassembly, flow control, Segments TCP, UDP
and error correction.
Handles logical addressing (IP addresses) and
3 Network Packets IP, ICMP, Routers
routing of data packets across different networks.
Provides reliable data transfer between adjacent
Ethernet, PPP,
2 Data Link network nodes. Handles physical addressing Frames
Switches, Bridges
(MAC addresses) and error detection.
Transmits raw binary data (bits) over a physical Coaxial cable, Fiber
1 Physical medium (e.g., cable, fiber, Wi-Fi). Deals with Bits optic, Hubs,
voltage levels, timings, and physical connections. Repeaters
Export to Sheets
Key Takeaway: The OSI model is a valuable tool for troubleshooting and for understanding the high-
level architecture of network communication. Data travels down the stack at the sender (with each layer
adding a header) and up the stack at the receiver (with each layer stripping off its header).
2. TCP/IP Model
The TCP/IP model is a practical, widely adopted model that forms the foundation of the internet. It is a
more condensed version of the OSI model, with a few key differences.
The most common version of the TCP/IP model has 4 layers:
OSI
Layer Name Function Protocols & Devices
Equivalent
4 Application Combines the functions of the OSI Layers 5, 6, HTTP, FTP, SMTP,
Application, Presentation, and Session layers. 7 DNS
OSI
Layer Name Function Protocols & Devices
Equivalent
Provides services to the user.
Provides end-to-end communication services.
3 Transport Handles segmentation, reassembly, flow Layer 4 TCP, UDP
control, and error correction.
Handles logical addressing (IP addresses) and
2 Internet routing of data packets across different Layer 3 IP, ICMP, Routers
networks.
Combines the functions of the OSI Data Link
Ethernet, WiFi, ARP,
Network and Physical layers. Deals with physical
1 Layers 1, 2 MAC addresses,
Access addressing and data transmission over the
Switches, Hubs
local network.
Export to Sheets
Comparison with OSI Model:
Layer Consolidation: The TCP/IP model is less granular, with fewer layers. The OSI model's
Presentation and Session layers are merged into the Application layer of TCP/IP. The Data Link
and Physical layers are merged into the Network Access layer.
Focus: The OSI model is a theoretical reference model. The TCP/IP model is a practical
implementation model based on the protocols that actually run the internet.
Protocol Independence: The OSI model was designed to be protocol-independent. The TCP/IP
model is largely centered around its core protocols: TCP and IP.
3. Networking Devices
Networking devices operate at specific layers of the OSI model and perform distinct functions.
5. Network Security
Network security is about protecting the confidentiality, integrity, and availability of computer
networks and data. It's a vast field, but we can break it down by its core goals.
Confidentiality (Keeping data secret):
Goal: Ensure that data is not read by unauthorized parties.
Threats: Eavesdropping, snooping, Man-in-the-Middle attacks.
Solutions:
Encryption: The process of converting data into an unreadable format (cipher-
text). SSL/TLS (Secure Sockets Layer/Transport Layer Security) encrypts data
between a web browser and a server.
Firewalls: Act as a barrier between a trusted internal network and an untrusted
external network (like the internet). They filter traffic based on a set of security
rules.
Integrity (Ensuring data is not tampered with):
Goal: Ensure that data remains unchanged during transmission or storage.
Threats: Data tampering, unauthorized modification.
Solutions:
Hashing: A cryptographic function that generates a fixed-size string (hash) from
any input data. Any change to the data will result in a completely different hash,
revealing tampering.
Digital Signatures: Uses public key cryptography to verify the authenticity and
integrity of a message. The sender signs the data with their private key, and the
receiver verifies it with the sender's public key.
Availability (Ensuring services are accessible):
Goal: Ensure that network services and data are available to authorized users when
needed.
Threats: DDoS (Distributed Denial of Service) attacks, system failures, power
outages.
Solutions:
Firewalls & IDS (Intrusion Detection Systems): Can block malicious traffic
that aims to overwhelm a server.
Redundancy: Having backup servers and network paths to ensure services
remain available if one part of the system fails.
DDoS Mitigation Services: Specialized services that absorb and filter attack
traffic before it reaches the target network.
Common Threats:
Malware: Malicious software like viruses, worms, and ransomware.
Phishing: Deceptive attempts to trick users into revealing sensitive information.
Spoofing: Faking the identity of a legitimate sender to gain access or credibility.
Address Space: It allows for approximately 4.3 billion unique addresses (232).
Problem: With the explosive growth of the internet and the proliferation of devices (laptops,
smartphones, IoT devices), the world has essentially run out of available IPv4 addresses. This
problem is known as IPv4 address exhaustion.
Mitigation: Technologies like NAT (Network Address Translation) were developed to
conserve addresses, but they are a temporary solution.
IPv6 (Internet Protocol version 6)
Structure: A 128-bit address, written in hexadecimal notation. It consists of eight groups of
four hexadecimal digits, separated by colons.
Example: 2001:0db8:85a3:0000:0000:8a2e:0370:7334 (often shortened by
omitting leading zeros and consecutive zero fields: 2001:db8:85a3::8a2e:370:7334)
Address Space: It allows for a virtually unlimited number of addresses, specifically 340
undecillion (2128) addresses, which solves the address exhaustion problem for the foreseeable
future.
Purpose: IPv6 was developed as the successor to IPv4 to not only solve the address shortage
but also to provide other improvements, such as simplified headers, better security features
(IPsec is built-in), and more efficient routing.
2. Types by Scope/Usage
These categories apply mainly to IPv4 addresses but the concepts extend to IPv6 as well.
Public IP Address
Definition: A globally unique IP address that is assigned to your network by your Internet
Service Provider (ISP). It is routable on the public internet.
Purpose: It identifies your entire network to the internet. When you visit a website, your public
IP address is what the website's server sees, allowing it to send information back to your
network.
Analogy: The public mailing address of your building.
Private IP Address
Definition: A non-globally routable IP address used within a private, local network (LAN) like
your home, school, or office.
Purpose: It allows devices within your local network to communicate with each other. A router
is responsible for assigning these private IP addresses to devices and using NAT to translate the
private addresses to the single public IP address when communicating with the internet.
Analogy: The apartment number within your building.
Reserved Ranges: The Internet Assigned Numbers Authority (IANA) has reserved specific
address blocks for private use, so they can be reused by every private network without conflict.
The most common ranges are:
[Link] to [Link]
[Link] to [Link]
[Link] to [Link]
Static IP Address
Definition: An IP address that is permanently assigned to a device and does not change. It is
manually configured.
Purpose: Used for devices that need a consistent, reliable address so they can be easily found
on a network. Common use cases include:
Web servers, mail servers, and DNS servers.
Printers or other network-attached devices.
Dynamic IP Address
Definition: An IP address that is temporarily assigned to a device from a pool of available
addresses. It can change periodically.
Purpose: This is the most common type for consumer devices like laptops and smartphones. It
is assigned automatically by a DHCP (Dynamic Host Configuration Protocol) server when a
device connects to a network.
Advantage: It simplifies network administration and helps conserve the limited number of IPv4
addresses.
Routing Protocols: These are used by routers to discover and maintain the best paths
for data to travel. Examples include:
OSPF (Open Shortest Path First): A common interior gateway protocol used to
route data within a single autonomous system.
BGP (Border Gateway Protocol): The "protocol of the Internet," used to route
data between different autonomous systems (large networks like those of ISPs).
An IPv4 address is a 32-bit number, typically written as four decimal numbers (octets) separated by
dots. In the classful system, the first few bits of an address's first octet determined its class. This, in
turn, dictated how the rest of the 32 bits were divided between the Network ID (identifying the specific
network) and the Host ID (identifying the specific device on that network).
Class A Addresses
First Bit: Always 0.
First Octet Range: 1 to 126. (The address [Link] is reserved, and [Link] is
reserved for loopback addresses).
Network & Host Bits: The first 8 bits are for the Network ID, and the remaining 24 bits are
for the Host ID.
Default Subnet Mask: [Link]
Class B Addresses
First Bits: Always 10.
Network & Host Bits: The first 16 bits are for the Network ID, and the remaining 16 bits are
for the Host ID.
Default Subnet Mask: [Link]
Scale: Designed for medium to large networks.
Number of Networks: 214=16,384
Number of Hosts per Network: 216−2=65,534
Use Case: Large universities and medium to large corporations.
Class C Addresses
First Bits: Always 110.
Network & Host Bits: The first 24 bits are for the Network ID, and the remaining 8 bits are
for the Host ID.
Default Subnet Mask: [Link]
Purpose: These addresses are not used for unicast communication (one-to-one). Instead, they
are reserved for multicasting, which is a one-to-many communication method where data is
sent from a single source to a specific group of recipients.
Example: [Link] is the address for all hosts on a local network.
Purpose: These addresses are reserved for experimental and future use and are not used for any
public or private addressing.
Summary Table
First Octet Network Host Hosts/
Class First Bits Networks Default Subnet Mask
Range Bits Bits Network
A 0 1 - 126 8 24 126 16,777,214 [Link]
B 10 128 - 191 16 16 16,384 65,534 [Link]
C 110 192 - 223 24 8 2,097,152 254 [Link]
D 1110 224 - 239 N/A N/A N/A N/A N/A
E 11110 240 - 255 N/A N/A N/A N/A N/A