EASYTUTORGUIDE

Practical tutorials, tools, courses, digital skills, and business promotion.

Free Learning

Chapter 2: OSI and TCP/IP Models

Learn Networking from very beginner to advanced through a complete course.

Beginner FriendlyExamplesPracticeProjects
Estimated reading time: 1 minute0% read

Networking

Chapter 2 — OSI and TCP/IP Models

This chapter explains how network communication is divided into layers. You will learn why networking models exist, all seven layers of the OSI model, the four layers of the TCP/IP model, encapsulation, de-encapsulation, frames, packets, segments, datagrams, PDUs, and how the OSI model can help with troubleshooting.

The sections below match the Chapter 2 sidebar exactly from 2.1 through 2.22.


2.1 Why Network Models Exist

Computer networks involve many different technologies working together. A device may need to use cables, wireless signals, MAC addresses, IP addresses, ports, protocols, applications, and many other components to communicate successfully.

If networking were treated as one enormous process, learning, designing, and troubleshooting networks would be extremely difficult.

Network models solve this problem by dividing communication into smaller logical layers.

Simple idea

Instead of thinking about networking as one large task:

Send data across network

we can divide it into smaller responsibilities:

Application
    ↓
Transport
    ↓
Network addressing
    ↓
Local delivery
    ↓
Physical transmission

Benefits of network models

  • Make networking easier to understand
  • Separate networking functions into layers
  • Help different vendors build compatible products
  • Help engineers design protocols
  • Make troubleshooting easier
  • Provide common networking terminology
  • Allow one layer to change without redesigning everything

Example

If a cable is unplugged, the problem involves physical connectivity.

If the cable works but an IP address is incorrect, the problem occurs at a different networking layer.

Network models divide networking into manageable layers with specific responsibilities.


2.2 OSI Model Overview

OSI stands for Open Systems Interconnection.

The OSI model is a conceptual networking model containing seven layers. Each layer represents a different part of the communication process.

The seven OSI layers

Layer 7 — Application
Layer 6 — Presentation
Layer 5 — Session
Layer 4 — Transport
Layer 3 — Network
Layer 2 — Data Link
Layer 1 — Physical

When studying the model, Layer 7 is normally shown at the top and Layer 1 at the bottom.

Very simple purpose of each layer

Layer Name Main Idea
7 Application Network services used by applications
6 Presentation Data format, encryption, compression
5 Session Manages communication sessions
4 Transport End-to-end transport and ports
3 Network IP addressing and routing
2 Data Link Frames and MAC addressing
1 Physical Signals, cables, connectors, bits

Memory aid

A common way to remember Layers 7 through 1 is:

All
People
Seem
To
Need
Data
Processing

That represents:

Application
Presentation
Session
Transport
Network
Data Link
Physical

OSI has seven layers, each representing a different networking function.


2.3 Layer 1 — Physical

Layer 1 of the OSI model is the Physical layer.

The Physical layer deals with the actual transmission of raw bits across network media.

Layer 1 includes

  • Copper cables
  • Fiber-optic cables
  • Wireless radio signals
  • Connectors
  • Network ports
  • Electrical signals
  • Light signals
  • Radio-frequency signals
  • Pinouts
  • Physical interfaces

Example

Computer
   |
Ethernet Cable
   |
Switch

The Ethernet cable and the electrical signals traveling through it are Layer 1 concepts.

Bits

Layer 1 deals with raw binary information:

1011010010101101

Common Layer 1 problems

  • Disconnected cable
  • Broken cable
  • Damaged connector
  • Bad network port
  • Weak wireless signal
  • Fiber damage
  • Incorrect cable type

Layer 1 = Physical = bits, signals, cables, connectors, and physical transmission.


2.4 Layer 2 — Data Link

Layer 2 is the Data Link layer.

It is responsible for communication across a local network segment.

Important Layer 2 concepts

  • Ethernet frames
  • MAC addresses
  • Switching
  • Local network delivery
  • Frame error detection
  • VLAN concepts

MAC addresses

Ethernet devices use MAC addresses for local communication.

00:1A:2B:3C:4D:5E

Frame example

+-------------------------+
| Destination MAC         |
+-------------------------+
| Source MAC              |
+-------------------------+
| Type / Length           |
+-------------------------+
| Data                    |
+-------------------------+
| Error Check             |
+-------------------------+

Switches

Ethernet switches primarily operate at Layer 2.

PC A ----\
          Switch ---- PC C
PC B ----/

The switch examines MAC addresses to help forward Ethernet frames.

Layer 2 = Data Link = frames, MAC addresses, and local network communication.


2.5 Layer 3 — Network

Layer 3 is the Network layer.

This layer is responsible for logical addressing and communication between different networks.

Important Layer 3 concepts

  • IP addresses
  • Routing
  • Routers
  • Packets
  • Network-to-network communication
  • Path selection

IP address example

192.168.1.10

Routing example

Network A
   |
 Router
   |
Network B

The router examines Layer 3 information to determine where packets should be sent.

Packet

The Layer 3 PDU is normally called a packet.

Source IP:      192.168.1.10
Destination IP: 10.0.0.20

Layer 3 = Network = packets, IP addresses, routers, and routing.


2.6 Layer 4 — Transport

Layer 4 is the Transport layer.

The Transport layer provides communication between applications on different devices.

Important Transport layer protocols

  • TCP
  • UDP

TCP

TCP provides connection-oriented communication and includes mechanisms for reliable delivery.

TCP can use:

  • Sequence numbers
  • Acknowledgments
  • Retransmissions
  • Flow control

UDP

UDP provides connectionless communication with less overhead.

It does not provide the same delivery guarantees as TCP.

Port numbers

Transport protocols use port numbers to identify applications and services.

Web Server
TCP Port 443

Layer 4 data units

TCP normally uses the term:

Segment

UDP commonly uses:

Datagram

Layer 4 = Transport = TCP, UDP, ports, segments, and datagrams.


2.7 Layer 5 — Session

Layer 5 is the Session layer.

The Session layer represents functions involved in establishing, maintaining, and ending communication sessions between applications.

What is a session?

A session is an ongoing communication relationship between two systems or applications.

Application A
     |
     | Session
     |
Application B

Session responsibilities can include

  • Starting communication sessions
  • Maintaining sessions
  • Coordinating communication
  • Ending sessions
  • Managing dialog between systems

Beginner example

Imagine two applications establish communication.

Start session
     ↓
Exchange information
     ↓
Maintain session
     ↓
Finish communication
     ↓
End session

In modern TCP/IP networking, session functions may be handled by applications or other protocols rather than appearing as one clearly separate protocol layer.

Layer 5 = Session = establishes, manages, and ends communication sessions.


2.8 Layer 6 — Presentation

Layer 6 is the Presentation layer.

This layer represents how information is formatted or transformed so applications can interpret it.

Presentation layer concepts

  • Data formatting
  • Data translation
  • Encryption
  • Decryption
  • Compression
  • Decompression
  • Character encoding

Formatting example

Different applications must understand the format of the information they exchange.

Raw Data
   ↓
Formatted Data
   ↓
Application

Encryption example

Readable Data
     ↓
Encryption
     ↓
Encrypted Data

Decryption

Encrypted Data
     ↓
Decryption
     ↓
Readable Data

Compression

Compression can reduce the amount of data that must be transmitted.

Layer 6 = Presentation = formatting, translation, encryption, and compression.


2.9 Layer 7 — Application

Layer 7 is the Application layer.

It is the layer closest to the software applications used by users.

The Application layer provides network services that applications can use.

Examples of Application layer protocols

  • HTTP
  • HTTPS
  • DNS
  • DHCP
  • SMTP
  • IMAP
  • FTP
  • SSH

Web example

Web Browser
    |
   HTTPS
    |
Web Server

DNS example

example.com
    |
   DNS
    |
IP Address

Important distinction

The Application layer is not simply the application itself.

For example, a web browser is an application, while protocols such as HTTP and HTTPS provide networking functions used by that application.

Layer 7 = Application = networking services used by applications.


2.10 TCP/IP Model

The TCP/IP model is the networking model closely associated with the protocol suite used by modern IP networks and the Internet.

A common four-layer TCP/IP model contains:

Application
Transport
Internet
Network Access

TCP/IP model

Layer Main Function
Application Application network services and data handling
Transport TCP, UDP, ports, end-to-end communication
Internet IP addressing and routing
Network Access Local network access and physical transmission

Data moves down the model when sending

Application
    ↓
Transport
    ↓
Internet
    ↓
Network Access

Data moves up when receiving

Network Access
    ↓
Internet
    ↓
Transport
    ↓
Application

TCP/IP is the practical protocol model associated with modern Internet communication.


2.11 Network Access Layer

The Network Access layer is the lowest layer of the four-layer TCP/IP model.

It handles communication with the local network and the physical network medium.

Network Access concepts include

  • Ethernet
  • Wi-Fi
  • MAC addresses
  • Frames
  • Network interface cards
  • Cables
  • Fiber
  • Radio signals

Example

Computer
   |
Ethernet NIC
   |
Ethernet Cable
   |
Switch

The Network Access layer roughly covers functions associated with OSI Layers 1 and 2.

OSI Layer 2 — Data Link
            \
             > TCP/IP Network Access
            /
OSI Layer 1 — Physical

TCP/IP Network Access = local network delivery and physical transmission.


2.12 Internet Layer

The TCP/IP Internet layer is responsible for moving packets between networks.

Its major protocol is IP.

Important Internet layer concepts

  • IPv4
  • IPv6
  • IP addresses
  • Packets
  • Routing
  • Routers

Example

Computer A
192.168.1.10
     |
   Router
     |
   Internet
     |
   Router
     |
Computer B
10.20.30.40

Routers use IP information to move packets toward their destination.

OSI comparison

OSI Layer 3 — Network
          ≈
TCP/IP Internet Layer

Internet layer = IP addresses, packets, and routing between networks.


2.13 Transport Layer

The TCP/IP Transport layer provides communication between applications running on different hosts.

Its two major protocols are:

  • TCP
  • UDP

TCP

TCP provides reliable, connection-oriented transport.

Application
    |
   TCP
    |
Network

UDP

UDP provides connectionless transport with lower overhead.

Application
    |
   UDP
    |
Network

Ports

Port numbers help identify the application or service that should receive the data.

IP Address + Port

192.168.1.20:443

OSI comparison

OSI Layer 4 — Transport
          ≈
TCP/IP Transport Layer

TCP/IP Transport = TCP, UDP, ports, and end-to-end application communication.


2.14 Application Layer

The TCP/IP Application layer combines many functions represented by the upper three layers of the OSI model.

It includes application networking protocols and functions related to data representation and application communication.

Examples

  • HTTP
  • HTTPS
  • DNS
  • DHCP
  • SMTP
  • IMAP
  • FTP
  • SSH

OSI comparison

OSI Layer 7 — Application
OSI Layer 6 — Presentation
OSI Layer 5 — Session
             |
             ↓
TCP/IP Application Layer

Example

Browser
   |
 HTTPS
   |
TCP/IP Application Layer

TCP/IP Application layer covers application networking and many OSI Layers 5–7 functions.


2.15 OSI vs TCP/IP

The OSI model contains seven layers, while the common TCP/IP model contains four layers.

Comparison

OSI TCP/IP
Layer 7 — Application Application
Layer 6 — Presentation
Layer 5 — Session
Layer 4 — Transport Transport
Layer 3 — Network Internet
Layer 2 — Data Link Network Access
Layer 1 — Physical

Visual comparison

OSI                         TCP/IP

Application   ┐
Presentation  ├──────────> Application
Session       ┘

Transport    ────────────> Transport

Network      ────────────> Internet

Data Link     ┐
Physical      ┘──────────> Network Access

Why learn both?

The TCP/IP model reflects the protocol architecture used by modern IP networks.

The OSI model is extremely useful for learning networking concepts and describing troubleshooting problems.

OSI = 7 layers. TCP/IP = commonly 4 layers.


2.16 Encapsulation

Encapsulation occurs when data moves down the networking stack and each layer adds information needed for communication.

Start with application data

DATA

Transport layer adds information

+----------------+
| Transport Info |
+----------------+
| Data           |
+----------------+

Network layer adds IP information

+----------------+
| IP Header      |
+----------------+
| Transport Info |
+----------------+
| Data           |
+----------------+

Data Link layer adds frame information

+----------------+
| Ethernet Header|
+----------------+
| IP Header      |
+----------------+
| Transport Info |
+----------------+
| Data           |
+----------------+
| Ethernet Trailer|
+----------------+

Then Layer 1 transmits bits

101101001101001011010...

Simple sequence

Application Data
      ↓
Segment / Datagram
      ↓
Packet
      ↓
Frame
      ↓
Bits

Encapsulation = adding networking information as data moves down the protocol stack.


2.17 De-encapsulation

De-encapsulation is the reverse of encapsulation.

It occurs when a receiving device processes incoming data and removes the information added by lower networking layers.

Receiving process

Bits
  ↓
Frame
  ↓
Packet
  ↓
Segment / Datagram
  ↓
Application Data

Step 1 — Physical

The receiving network interface receives signals and interprets them as bits.

Step 2 — Data Link

The frame is processed and Layer 2 information is examined.

Step 3 — Network

The IP packet is processed.

Step 4 — Transport

TCP or UDP information is examined and the data is delivered toward the correct application.

Step 5 — Application

The receiving application receives the original information.

De-encapsulation = removing networking information as received data moves up the protocol stack.


2.18 Frames

A frame is the Protocol Data Unit associated with the Data Link layer.

Ethernet uses frames to deliver data across the local network.

Simplified Ethernet frame

+-----------------------+
| Destination MAC       |
+-----------------------+
| Source MAC            |
+-----------------------+
| Type / Length         |
+-----------------------+
| Data                  |
+-----------------------+
| Frame Check Sequence  |
+-----------------------+

Destination MAC address

Identifies the intended Layer 2 destination.

Source MAC address

Identifies the Layer 2 sender.

Data

The frame's payload can contain a Layer 3 packet.

Ethernet Frame
+--------------------------------+
| Ethernet Header                |
|                                |
|   IP Packet                    |
|   +------------------------+   |
|   | IP Header              |   |
|   | Transport Data         |   |
|   +------------------------+   |
|                                |
+--------------------------------+

FCS

The Frame Check Sequence helps detect transmission errors.

Frame = Layer 2 PDU used for local network communication.


2.19 Packets

A packet is the Protocol Data Unit associated with the Network layer.

IP packets contain logical addressing information used to deliver data between networks.

Simplified packet

+---------------------------+
| Source IP Address         |
+---------------------------+
| Destination IP Address    |
+---------------------------+
| Protocol Information      |
+---------------------------+
| Transport Layer Data      |
+---------------------------+

Example

Source IP
192.168.1.10

Destination IP
10.0.0.25

Routers process packets

Source Network
      |
    Router
      |
    Router
      |
Destination Network

Routers use destination IP addressing and routing information to determine where the packet should go.

Packet inside frame

Frame
  |
  +---- Packet
          |
          +---- Transport Data

Packet = Layer 3 PDU containing IP addressing information.


2.20 Segments and Datagrams

At the Transport layer, the terms segment and datagram are commonly used.

TCP Segment

TCP data is commonly called a segment.

+-------------------------+
| Source Port             |
+-------------------------+
| Destination Port        |
+-------------------------+
| Sequence Information    |
+-------------------------+
| Other TCP Information   |
+-------------------------+
| Data                    |
+-------------------------+

UDP Datagram

UDP data is commonly called a datagram.

+---------------------+
| Source Port         |
+---------------------+
| Destination Port    |
+---------------------+
| Length / Checksum   |
+---------------------+
| Data                |
+---------------------+

Key distinction

TCP → Segment

UDP → Datagram

Port example

Client
Source Port: 51500

        ↓

Server
Destination Port: 443

TCP uses segments; UDP uses datagrams.


2.21 PDUs

PDU means Protocol Data Unit.

A PDU is the name given to data at a particular layer of the networking model.

Important PDU names

OSI Layer PDU
Layer 7 — Application Data
Layer 6 — Presentation Data
Layer 5 — Session Data
Layer 4 — Transport Segment / Datagram
Layer 3 — Network Packet
Layer 2 — Data Link Frame
Layer 1 — Physical Bits

Sending sequence

DATA
  ↓
SEGMENT / DATAGRAM
  ↓
PACKET
  ↓
FRAME
  ↓
BITS

Receiving sequence

BITS
  ↓
FRAME
  ↓
PACKET
  ↓
SEGMENT / DATAGRAM
  ↓
DATA

Important exam memory

Layer 1 = Bits
Layer 2 = Frames
Layer 3 = Packets
Layer 4 = Segments / Datagrams

PDU = the form and name of data at a specific networking layer.


2.22 Troubleshooting by OSI Layer

The OSI model can be used as a structured way to troubleshoot network problems.

Instead of randomly changing settings, a technician can investigate the problem layer by layer.

Layer 1 — Physical problems

Check:

  • Cables
  • Connectors
  • Network ports
  • Link lights
  • Wireless signal
  • Physical damage

Example

No link light
    ↓
Check cable
    ↓
Check port
    ↓
Check NIC

Layer 2 — Data Link problems

Possible problems include:

  • Incorrect VLAN
  • MAC-related issues
  • Switch-port problems
  • Frame errors

Layer 3 — Network problems

Check:

  • IP address
  • Subnet mask
  • Default gateway
  • Routing
IP Address:      192.168.1.20
Subnet Mask:     255.255.255.0
Default Gateway: 192.168.1.1

Layer 4 — Transport problems

Investigate:

  • TCP
  • UDP
  • Port numbers
  • Firewall rules affecting ports

Upper-layer problems

Possible issues can involve:

  • DNS
  • Authentication
  • Applications
  • Web services
  • Encryption
  • Application configuration

Troubleshooting example

A user reports:

“I cannot open a website.”

You might investigate in an organized sequence:

Layer 1
Is the cable/Wi-Fi connection working?
        ↓
Layer 2
Is local network communication working?
        ↓
Layer 3
Does the computer have correct IP configuration?
Can it reach the gateway?
        ↓
Layer 4
Is the required TCP/UDP communication allowed?
        ↓
Upper Layers
Does DNS work?
Is the web service available?
Is the application configured correctly?

Chapter 2 memory table

Concept Remember
OSI Layer 7 Application
OSI Layer 6 Presentation
OSI Layer 5 Session
OSI Layer 4 Transport
OSI Layer 3 Network
OSI Layer 2 Data Link
OSI Layer 1 Physical
TCP/IP Application Roughly OSI 5–7
TCP/IP Transport Roughly OSI Layer 4
TCP/IP Internet Roughly OSI Layer 3
TCP/IP Network Access Roughly OSI Layers 1–2
Encapsulation Add headers/information while moving downward
De-encapsulation Remove/process information while moving upward
Frame Layer 2
Packet Layer 3
Segment TCP at Layer 4
Datagram UDP at Layer 4
Bits Layer 1

Final Chapter 2 review

2.1  Why Network Models Exist
2.2  OSI Model Overview
2.3  Layer 1 — Physical
2.4  Layer 2 — Data Link
2.5  Layer 3 — Network
2.6  Layer 4 — Transport
2.7  Layer 5 — Session
2.8  Layer 6 — Presentation
2.9  Layer 7 — Application
2.10 TCP/IP Model
2.11 Network Access Layer
2.12 Internet Layer
2.13 Transport Layer
2.14 Application Layer
2.15 OSI vs TCP/IP
2.16 Encapsulation
2.17 De-encapsulation
2.18 Frames
2.19 Packets
2.20 Segments and Datagrams
2.21 PDUs
2.22 Troubleshooting by OSI Layer

These 22 right-side sections now match the 22 Chapter 2 sidebar subchapters exactly.


A modern course built to help learners study step by step with clarity, comfort, and confidence.