Network security

OSI Model Layers: The 7 Layers Explained with Examples & Security Uses

The OSI model splits network communication into seven layers, from cables to applications. Here is what each layer does, which protocols live there, and how to use it to troubleshoot.

Cysoro Security TeamPublished · 7 min read
L7L6L5L4L3L2L1 NETWORK SECURITY OSI model 7 layers From cables to applications, layer by layer.
Quick answer

The OSI model divides network communication into seven layers: 7 Application, 6 Presentation, 5 Session, 4 Transport, 3 Network, 2 Data Link and 1 Physical. The physical layer moves raw bits, the data link layer frames them, the network layer routes packets by IP address, the transport layer delivers segments with TCP or UDP, the session layer manages connections, the presentation layer handles encryption and formatting, and the application layer provides HTTP, SMTP and DNS.

Key takeaways

  • The OSI model has 7 layers, from Physical (1) at the bottom to Application (7) at the top.
  • Each layer adds its own header as data travels down the stack, and removes it on the way up.
  • The model is a troubleshooting map: locate the failing layer before you guess at a fix.

Every time you open a website, your request travels through seven conceptual layers — and the reply travels back through them in reverse. The OSI model names those layers, and once you know them, network problems stop being mysterious and start being locatable.

What is the OSI model?

The OSI (Open Systems Interconnection) model is a conceptual framework that divides network communication into seven abstract layers, providing a standardized approach for different computer systems, applications and network devices to communicate across networks.

It was introduced in 1983 and adopted by ISO as an international standard in 1984 (ISO/IEC 7498), as Imperva's OSI guide records. The modern internet is not based on OSI protocols — it runs on the simpler TCP/IP model — but the OSI seven-layer model is still widely used because it helps visualize and communicate how networks operate.

Each layer interacts with the layer directly above and below it, encapsulating and transmitting data in a structured manner. That structure is what makes the model useful for troubleshooting: problems can be isolated to a specific layer.

What are the 7 layers of the OSI model?

The seven layers, from top to bottom, are Application (7), Presentation (6), Session (5), Transport (4), Network (3), Data Link (2) and Physical (1). A common mnemonic is "All People Seem To Need Data Processing".

LayerNameData unitMain jobExample protocols / devices
7ApplicationDataNetwork services for user applicationsHTTP, HTTPS, SMTP, DNS, FTP
6PresentationDataTranslation, encryption, compressionTLS/SSL, JPEG, ASCII, EBCDIC
5SessionDataEstablish, manage and end sessionsNetBIOS, RPC, SQL sessions
4TransportSegmentReliable end-to-end deliveryTCP, UDP
3NetworkPacketAddressing and routingIP, ICMP, routers
2Data linkFrameNode-to-node delivery on a local networkEthernet, Wi-Fi, switches, MAC
1PhysicalBitRaw bit transmission over a mediumCables, fiber, radio, hubs

Layers 5–7 are the software layers, layer 4 bridges software and hardware, and layers 1–3 are the hardware layers. Each layer adds its own encapsulation information — a header — to the data before passing it down, and removes it on the way back up.

The 7 OSI layers — top to bottom 7 Application — HTTP, SMTP, DNS 6 Presentation — encryption, format 5 Session — connections, checkpoints 4 Transport — TCP and UDP 3 Network — IP routing 2 Data link — Ethernet, MAC, frames 1 Physical — cables, fiber, radio
The seven OSI layers, with the protocols and devices at each layer. Illustration by Cysoro.

Layer 7: Application layer

The application layer is the OSI layer closest to end users. It provides network services directly to user applications and facilitates communication between software and lower layers — but the applications themselves are not part of this layer.

Protocols at this layer include HTTP and HTTPS for web communication, SMTP for email, DNS for resolving domain names to IP addresses, and FTP for file transfers, as listed in BMC's OSI guide. When your browser requests a page, that request starts here.

Layer 6: Presentation layer

The presentation layer, also known as the syntax layer, is responsible for translating data between the application layer and the network format. It ensures that data sent from one system is readable by the application layer of another system.

This layer handles data formatting, encryption and compression. It may convert data from ASCII to EBCDIC, compress a file to reduce its size, or encrypt it so it can travel safely. TLS, which protects HTTPS traffic, operates at this boundary — which is why encryption is usually described as a layer 6 function.

Layer 5: Session layer

The session layer manages and controls the connections between computers. It establishes, maintains and terminates sessions, ensuring that data exchanges occur efficiently and in an organized manner.

It is responsible for session checkpointing and recovery, which allows sessions to resume after interruptions, and for deciding how long a session lasts and how data is transmitted within it. Protocols operating here include Remote Procedure Call (RPC) and the session establishment phase in NetBIOS and SQL.

Layer 4: Transport layer

The transport layer provides end-to-end communication services for applications. It ensures complete data transfer, error recovery and flow control between hosts, and it segments and reassembles data for efficient transmission.

Its two main protocols are TCP and UDP. TCP is connection-oriented and ensures reliable data transfer with error checking and flow control, making it suitable for web browsing and email. UDP is connectionless, offering faster though less reliable transmission, suitable for video streaming and online gaming. Choosing between them is a trade-off between reliability and speed.

Layer 3: Network layer

The network layer is responsible for data routing, forwarding and addressing. It determines the best physical path for data to reach its destination based on network conditions and priority, and it manages logical addressing through IP addresses.

Key protocols here include the Internet Protocol (IP) for routing and addressing, ICMP for diagnostic and error reporting — the protocol behind ping — and routing protocols such as RIP and OSPF that manage how routers exchange path information. Routers are layer 3 devices.

Layer 2: Data link layer

The data link layer is responsible for node-to-node data transfer and error detection and correction. It ensures data is transmitted to the correct device on a local network segment, managing MAC (Media Access Control) addresses.

It is divided into two sublayers: Logical Link Control (LLC) and Media Access Control (MAC). Protocols and technologies here include Ethernet, which defines the rules for data transmission over local area networks, Wi-Fi, and Point-to-Point Protocol (PPP). Switches are layer 2 devices.

Layer 1: Physical layer

The physical layer is responsible for the physical connection between devices. It defines the hardware elements involved, including cables, switches and other physical components, and it specifies the electrical, optical and radio characteristics of the network.

Its functions include modulation, bit synchronization and transmission of raw binary data over the physical medium. Technologies such as fiber optics and Wi-Fi operate at this layer, ensuring that data physically moves from one device to another. A loose cable, a dead port or a failed transceiver is a layer 1 problem.

How does data flow through the OSI layers? An email example

When you send an email, data traverses all seven layers. Your email client uses SMTP at layer 7 to prepare the message, layer 6 formats and encrypts it, and layer 5 establishes a session with the mail server.

Layer 4 then breaks the message into segments with TCP, layer 3 adds IP addresses and routes the packets, layer 2 creates frames with MAC addresses, and layer 1 converts the frames to electrical signals or light pulses.

On arrival, the process reverses: the physical layer converts signals back to data, the data link layer reassembles frames, the network layer checks addressing, the transport layer reorders segments, the session layer maintains the session until receipt is complete, the presentation layer decrypts and formats the message, and the application layer delivers it to the recipient's inbox.

OSI vs TCP/IP — how the models map OSI 7 Application OSI 6 Presentation OSI 5 Session TCP/IP Applicationcovers OSI layers 5, 6 and 7 OSI 4 Transport — TCP / UDP TCP/IP Transport OSI 3 Network — IP TCP/IP Internet TCP/IP collapses OSI layers 5–7 into one application layer and layers 1–2 into network access.
OSI vs TCP/IP: the internet runs on TCP/IP, but OSI is the map people use to talk about it. Illustration by Cysoro.

OSI model vs TCP/IP model: what's the difference?

TCP/IP is older than the OSI model and was created by the US Department of Defense. The key difference is that TCP/IP is simpler, collapsing several OSI layers into one: OSI layers 5, 6 and 7 become one application layer in TCP/IP, and OSI layers 1 and 2 become one network access layer.

Other differences matter for exams and for design. TCP/IP is a functional model based on specific, standard protocols. OSI is a generic, protocol-independent model intended to describe all forms of network communication. In TCP/IP, most applications use all the layers, while in OSI simple applications do not use all seven — only layers 1, 2 and 3 are mandatory to enable any data communication.

Security at each OSI layer

Every layer has its own threats and its own defenses, which is why security teams map controls to layers. A firewall at layers 3–4 blocks unwanted packets; a next-generation firewall at layer 7 inspects application traffic; TLS at layer 6 protects data in transit; and physical security at layer 1 stops someone unplugging a cable or plugging in a rogue device.

LayerThreatDefense
7 ApplicationPhishing, SQL injection, malicious appsWAF, secure coding, email filtering
6 PresentationWeak encryption, certificate spoofingTLS, strong ciphers, certificate checks
5 SessionSession hijackingSecure cookies, session timeouts
4 TransportSYN floods, port scanningFirewalls, rate limiting
3 NetworkIP spoofing, route hijackingIngress filtering, routing security
2 Data linkARP spoofing, MAC floodingPort security, DHCP snooping
1 PhysicalCable tampering, rogue devicesLocked rooms, port control

How to use the OSI model to troubleshoot

Start at the bottom and work up. Check the cable and the link light (layer 1), then whether the device has a MAC address and can reach its gateway (layer 2), then whether it can ping by IP address (layer 3), then whether TCP connects on the right port (layer 4), then whether the application responds (layer 7).

Port numbers are part of the transport-layer story — our guide to how to secure your Wi-Fi shows the home-network side of the same ideas.

That order saves time because most network faults are low-layer faults: a bad cable, a wrong VLAN, or a missing route. Guessing at the application first wastes hours on a problem that lives in the wiring.

The bottom line

The OSI model is a map, not a machine. Learn the seven layers, the job each one does, and the protocols that live there, and you can describe any network problem precisely — which is the first step to fixing it.

You can check the network-facing side of your own setup with our free DNS lookup tool.

For email security at the application layer, see what DMARC is and how to set it up.

Frequently asked questions

What are the 7 layers of the OSI model?

From top to bottom: 7 Application, 6 Presentation, 5 Session, 4 Transport, 3 Network, 2 Data Link and 1 Physical. A common mnemonic is All People Seem To Need Data Processing, read from layer 7 down to layer 1.

What is the OSI model used for?

It is a conceptual framework for describing how network communication works. Network professionals use it as a common language, to design and document networks, and to troubleshoot by isolating a problem to one layer instead of guessing across the whole stack.

What is the difference between the OSI model and the TCP/IP model?

TCP/IP is the functional model the internet actually runs on, with four layers. OSI is a generic, protocol-independent model with seven layers. TCP/IP collapses OSI layers 5, 6 and 7 into one application layer, and layers 1 and 2 into one network access layer.

Which OSI layer is TCP?

TCP operates at layer 4, the transport layer. It provides reliable, ordered, error-checked delivery between hosts. UDP also operates at layer 4, but it is connectionless and faster, suited to video streaming and online gaming.

Which OSI layer is a firewall?

It depends on the firewall. A basic packet-filtering firewall works at layer 3, the network layer, and layer 4, the transport layer. A next-generation firewall also inspects layer 7, the application layer, to identify applications and block threats inside web traffic.

Which OSI layer is encryption?

Encryption is mainly a layer 6, presentation layer, function: it translates data into a protected format before transmission and decrypts it on receipt. TLS, which protects HTTPS, operates between the transport and application layers and is often described as working at layer 6.

Is the OSI model still relevant?

Yes, as a teaching and troubleshooting framework, even though the modern internet runs on TCP/IP rather than OSI protocols. Job interviews, certifications and network documentation still use OSI layer numbers as shorthand for where a problem or a device sits.

Sources

  1. Imperva — What is OSI Model: 7 Layers Explained
  2. BMC — What is the OSI Model? The 7 Layers Explained
  3. Wikipedia — OSI protocols
  4. Cloudflare — What is the OSI model?
  5. Cisco — What Is the OSI Model?
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against Imperva's OSI guide, BMC's OSI guide and the ISO/IEC 7498 OSI reference model.

How we write and fact-check →

Free tools for this topic

No account needed.

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free