Skip to content
TechToolsHQ
NewsReviewsGuidesTech 101Tech SeriesToolsNewsletter
TechToolsHQ

Independent, research-driven tech coverage — breaking news, in-depth reviews, buying guides, and technical tutorials to help you understand and choose with confidence.

Explore
NewsReviewsGuidesTech 101Tech SeriesFree Tools
Legal
About UsOur AuthorsContact UsPrivacy PolicyTerms of ServiceCopyright & DMCAAffiliate DisclosureEditorial PolicyAdvertise With Us

© 2026 TechToolsHQ. All rights reserved.

Tech Series/DevOps/How Data Flows Across the Internet: The OSI Model, Layer by Layer
DevOps · Part 4 of 5

How Data Flows Across the Internet: The OSI Model, Layer by Layer

One message, seven layers: what gets added on the way out and removed on the way in.

By Himanshu Bhatt· 3 min read· September 30, 2026

How Data Flows and the OSI Model — article cover.
Key Takeaways · TL;DR
  • Data travels down the sender’s stack, across the network, and up the receiver’s stack — the same seven layers on both machines.
  • The OSI model splits networking into 7 layers: Application, Presentation, Session, Transport, Network, Data Link, Physical.
  • Encapsulation wraps the data on the way down: each layer adds its own header (and the data link layer a trailer too).
  • The unit is renamed at each layer: data → segment (transport) → packet (network) → frame (data link) → bits (physical).
  • Decapsulation is the exact reverse at the receiver: each layer removes its own header on the way up.
  • Switches work at Layer 2 (MAC); routers work at Layer 3 (IP) — which is why they are called layer-2 and layer-3 devices.
☰ On this page(show)(close)
  • 1.The big picture: two machines and a network
  • 2.What is the OSI model?
  • 3.Encapsulation: what gets added on the way down
  • 4.The per-layer summary
  • 5.A complete example: an HTTPS request
  • •Going down Machine A (encapsulation)
  • •Across the network
  • •Going up Machine B (decapsulation)
  • 6.Where routers and switches fit
On this page
  • 1.The big picture: two machines and a network
  • 2.What is the OSI model?
  • 3.Encapsulation: what gets added on the way down
  • 4.The per-layer summary
  • 5.A complete example: an HTTPS request
  • •Going down Machine A (encapsulation)
  • •Across the network
  • •Going up Machine B (decapsulation)
  • 6.Where routers and switches fit
INFO

Part 4 of the DevOps series. Parts 1 to 3 covered the terms and the request journey; here we go one level deeper — the complete path a message takes from one machine to another across the internet, and the model that explains it: the OSI model, layer by layer, including exactly what gets added and removed at each layer.

The big picture: two machines and a network

At the highest level, sending data is simple: it travels down the sender’s stack, across the network, and up the receiver’s stack. The same set of layers exists on both machines, so each layer effectively has a conversation with its counterpart on the other side.

Machine A encapsulates the data down its stack from layer 7 to layer 1; the network of routers and switches forwards the bits; Machine B decapsulates them back up its stack from layer 1 to layer 7. The same layers exist on both machines.
Down the sender, across the network, up the receiver.
●FROM ONE MACHINE TO ANOTHER
Machine A
Network
Machine B
  • •Machine A wraps the data layer by layer (encapsulation); the receiver unwraps it in reverse (decapsulation).
  • •The same layers exist on both machines, so each layer talks to its peer.

What is the OSI model?

The OSI (Open Systems Interconnection) model is a reference model that splits networking into seven layers, each with one clear job. Data is handed from one layer to the next, and every layer only needs to understand its own job — that separation is what makes networking manageable.

The seven OSI layers, top to bottom: 7 Application (HTTP, DNS), 6 Presentation (TLS, encoding), 5 Session, 4 Transport (TCP/UDP, ports, segments), 3 Network (IP, packets), 2 Data Link (MAC, frames), 1 Physical (bits).
The seven layers, from the application at the top to the physical wire.
Layer architecture
LAYER 7
Application

HTTP, DNS, SMTP - the user's data

LAYER 6
Presentation

TLS, encoding, compression

LAYER 5
Session

open, manage, and close the conversation

LAYER 4
Transport

TCP or UDP, ports, segments

LAYER 3
Network

IP addressing and routing, packets

LAYER 2
Data Link

MAC framing, frames

LAYER 1
Physical

bits on the medium

Encapsulation: what gets added on the way down

As data moves down the sender’s stack, each layer wraps it in that layer’s own header (and the data-link layer adds a trailer too). This wrapping is called encapsulation, and the unit of data gets a new name at each step — its Protocol Data Unit, or PDU.

Encapsulation down the sender stack: application data; the transport layer adds a header with ports to make a segment; the network layer adds an IP header to make a packet; the data-link layer adds a MAC header and trailer to make a frame; the physical layer sends bits.
Each layer adds its header; the unit is renamed data → segment → packet → frame → bits.
Progressive Breakdown
Stage 1

Application data is your HTTP request

Stage 2

Transport adds ports, making a segment

Stage 3

Network adds IP addresses, making a packet

Stage 4

Data link adds MAC and a trailer, making a frame

Stage 5

Physical sends the frame as bits

The result is a set of nested envelopes: the application’s data sits inside a transport segment, inside a network packet, inside a data-link frame. Each header is read by the matching layer on the other machine.

[ Frame   — MAC src/dst + FCS trailer
  [ Packet   — IP src/dst
    [ Segment   — TCP ports + sequence
      [ HTTP data ] ] ] ]

The per-layer summary

Put side by side, here is what each layer is responsible for and what it adds to the data on the way down.

LayerPDUWhat it adds
7 · ApplicationDataThe message itself (HTTP, DNS, SMTP)
6 · PresentationDataEncryption / encoding (e.g. TLS)
5 · SessionDataSession setup and control
4 · TransportSegmentSource + destination ports (TCP/UDP)
3 · NetworkPacketSource + destination IP addresses
2 · Data LinkFrameSource + destination MAC + FCS trailer
1 · PhysicalBitsNothing — just signals on the medium

A complete example: an HTTPS request

Say Machine A’s browser (private IP 192.168.1.10) requests a page from Machine B’s web server (13.234.56.78) over HTTPS. Follow the same request down, across, and up. The addresses and ports below are illustrative.

Going down Machine A (encapsulation)

Each layer adds its own information before handing the data to the layer below:

LayerAdded at Machine A
7 · ApplicationGET / HTTP/1.1 (Host: example.com)
4 · Transport (TCP)src port 54321, dst port 443
3 · Network (IP)src 192.168.1.10, dst 13.234.56.78
2 · Data Linksrc + dst MAC, plus FCS trailer
1 · Physicalbits over Wi-Fi or Ethernet

Across the network

Routers forward the packet toward its destination based on the IP header (Layer 3). At each hop, the Layer 2 frame is rebuilt with new source and destination MAC addresses for the next link, while the Layer 3 packet (the IP addresses) stays the same end to end. On the way out of your network, NAT also swaps your private source IP for the router’s public IP.

Going up Machine B (decapsulation)

When the bits arrive at Machine B, the process runs in reverse — decapsulation. The physical layer reads the bits into a frame; the data-link layer checks the trailer and strips the MAC header; the network layer strips the IP header; the transport layer strips the TCP header and hands the ports to the right application; and finally the server’s application receives the original HTTP request, exactly as it was sent.

Where routers and switches fit

This is also why network devices are described by layer. A switch operates at Layer 2 — it forwards frames using MAC addresses on the local network. A router operates at Layer 3 — it forwards packets between networks using IP addresses. When someone says "a layer-3 device," this is the layer they mean.

INFO

That is the full journey: down the sender’s seven layers, across the network, and up the receiver’s — with a header added at each step on the way out and removed on the way in. The OSI model is the teaching model; next in the DevOps series, we map the same flow onto the model the internet actually runs on — the TCP/IP model.

Drafted with AI assistance and edited by TechToolsHQ.

Share
Series: DevOps

Part 4 — How Data Flows Across the Internet: The OSI Model, Layer by Layer

Part 4 of 5
← Previous partPart 3 — IP Addresses and Ports: Public vs Private, NAT, and localhostNext part →Part 5 — The TCP/IP Model: How Data Really Flows on the Internet

Enjoying the DevOps series?

TechToolsHQ is an independent, reader-supported tech platform. If this article saved you time, solved a tough problem, or helped you learn a new skill, consider supporting our work. Your support helps us keep our in-depth series 100% free and updated for everyone.

100% optional · Reader supported · Independent researchSupport our work

Don't miss the next deep-dive

Weekly breakdowns of the tools students and builders actually use.

No spam·Unsubscribe any time·Privacy-first