OSI Model Explained: The 7 Layers and How to Troubleshoot Each One

It is 3 AM and a client’s banking application is crawling, or completely unreachable. One engineer is checking firewall rules. Another is restarting the web server. A third is reading application logs. Everyone is guessing, and nobody can say where the problem actually is.

The OSI model fixes that. It splits network communication into seven layers, so instead of guessing you can test one layer at a time and prove where the failure starts. In five years of working with Zscaler and enterprise firewalls, the layered approach is the single habit that has saved me the most troubleshooting time.

This guide explains each of the seven layers in plain language, shows how they map to the TCP/IP model, and then turns the model into a practical tool: a command for testing every layer, four real-style troubleshooting cases, and the attacks and defences that belong to each layer.

Key takeaways

  • The OSI model is a reference model, not a protocol. Real networks run TCP/IP, but engineers still describe problems in OSI terms (“it is a Layer 2 issue”).
  • Troubleshoot bottom-up: link, then local network, then IP, then ports, then the application. Most “application” outages turn out to be lower-layer problems.
  • Each layer has its own failure symptoms, test commands and attacks. The cheat sheet below puts them on one page.

What is the OSI model?

The OSI (Open Systems Interconnection) model is a conceptual framework published by the International Organization for Standardization (ISO) as ISO/IEC 7498-1, and by the ITU as Recommendation X.200. It describes network communication as seven layers, where each layer provides a service to the layer above it and relies on the layer below.

Because each layer has a defined job, vendors can build products that interoperate, and engineers share a common language. When someone says “this is a Layer 3 problem”, everyone knows to look at IP addressing and routing, not at cables or application code.

A simple way to remember the order from Layer 7 down to Layer 1 is: All People Seem To Need Data Processing (Application, Presentation, Session, Transport, Network, Data Link, Physical).

The 7 layers at a glance

This table is the part of the article most worth bookmarking. It links each layer to what it does, what can go wrong, and how to test it.

LayerJobData unitExamplesTypical failureQuick test
7 ApplicationNetwork services for appsDataHTTP, DNS, SMTP, SSHHTTP 500, DNS SERVFAILcurl -v, nslookup
6 PresentationFormat, encoding, encryptionDataTLS, UTF-8, JPEGTLS version or cipher mismatchopenssl s_client
5 SessionOpen, keep and close sessionsDataRPC, NetBIOS, SMB sessionsSession timeouts, frequent re-authApp and auth logs
4 TransportEnd-to-end delivery, portsSegment / datagramTCP, UDPPort blocked, resets, MSS issuesTest-NetConnection -Port
3 NetworkAddressing and routingPacketIPv4, IPv6, ICMPWrong gateway, missing routeping, tracert
2 Data LinkDelivery on the local segmentFrameEthernet, Wi-Fi, ARP, VLANsWrong VLAN, duplicate IP, looparp -a, switch logs
1 PhysicalBits on the mediumBitsCables, fibre, radio, NICsLink down, CRC errorsLink LEDs, interface counters

The layer assignments for TLS and ARP are approximations. TLS is often placed at Layer 6, but in practice it sits between the transport and application layers. ARP links Layer 3 addresses to Layer 2 addresses and is sometimes described as “Layer 2.5”. The model is a guide, not a strict rulebook.

Each layer explained

Whiteboard diagram mapping the seven OSI layers to network devices such as hubs, switches, routers and firewalls

Layer 7: Application

The layer closest to the user. It provides network services to applications through protocols such as HTTP/HTTPS, DNS, SMTP, FTP and SSH. Your browser is not Layer 7. The HTTP protocol it speaks is. Web application firewalls, secure web gateways and proxies inspect traffic at this layer.

Layer 6: Presentation

Makes sure data arrives in a format the receiving application can use. That covers character encoding (such as UTF-8), compression and, in the classic teaching model, encryption and decryption with TLS. If a client only supports TLS 1.0 and the server requires TLS 1.2 or later, the connection fails here.

Layer 5: Session

Establishes, maintains and ends sessions between two systems, including checkpoints and recovery for long exchanges. In TCP/IP networks, session functions are usually handled by the application itself, which is why Layer 5 problems often show up as login loops or sessions that drop after a fixed time.

Layer 4: Transport

Provides end-to-end delivery between processes, identified by port numbers. TCP is connection-oriented and reliable (the three-way handshake, acknowledgements, retransmission). UDP is connectionless and faster, used for DNS queries, VoIP and streaming. Stateful firewalls make most of their decisions at this layer.

Layer 3: Network

Handles logical addressing and routing between networks using IP addresses. Routers and Layer 3 switches operate here. A wrong default gateway, a missing route or an overlapping subnet are classic Layer 3 faults.

Layer 2: Data Link

Moves frames between devices on the same local network using MAC addresses. Ethernet, Wi-Fi (802.11), VLAN tagging (802.1Q) and switching all live here. ARP resolves an IP address to a MAC address so a frame can be delivered locally.

Layer 1: Physical

The actual medium: copper cables, fibre, radio signals, connectors and network interface cards. Layer 1 problems include damaged cables, dirty fibre connectors, duplex mismatches and Wi-Fi interference. They are easy to check and often skipped. See the network devices guide for which hardware works at which layer.

How data moves through the layers: encapsulation

When you open https://technaga.com, your request travels down the layers on your device. Each layer wraps the data from the layer above with its own header, a process called encapsulation:

  1. Layers 7 to 5: the browser builds an HTTP request, and TLS encrypts it.
  2. Layer 4: TCP adds source and destination ports (for example, a random high port to 443) and becomes a segment.
  3. Layer 3: IP adds source and destination IP addresses and becomes a packet.
  4. Layer 2: Ethernet or Wi-Fi adds source and destination MAC addresses (your device and your gateway) plus an error-check trailer and becomes a frame.
  5. Layer 1: the NIC sends the frame as electrical signals, light or radio waves.

At the server, the process runs in reverse (decapsulation). Each layer checks and removes its own header before passing the data up. Notice that MAC addresses change at every router hop, while the IP addresses stay the same end to end (unless NAT rewrites them).

Diagram of data encapsulation as an HTTPS request moves down the OSI layers, gaining TCP, IP and Ethernet headers

OSI model vs TCP/IP model

The Internet runs on the TCP/IP model, described in RFC 1122. It has four layers instead of seven, but the two map onto each other cleanly:

OSI layerTCP/IP layerExamples
7 Application, 6 Presentation, 5 SessionApplicationHTTP, DNS, TLS, SSH
4 TransportTransportTCP, UDP
3 NetworkInternetIP, ICMP
2 Data Link, 1 PhysicalLink (network access)Ethernet, Wi-Fi, ARP

Use TCP/IP to understand how protocols are actually built. Use OSI to troubleshoot and communicate, because its finer split (especially at the bottom) helps you isolate faults. The TCP/IP model guide covers the four-layer model in more depth.

How to troubleshoot with the OSI model, layer by layer

Work from the bottom up. Each step only makes sense once the layer below it passes. The commands below are for Windows, with Linux equivalents in the comments.

Flowchart of bottom-up network troubleshooting from the physical layer to the application layer
# Layer 1 - is the link up?
Get-NetAdapter                      # Linux: ip link show
# Look for Status = Up and the expected link speed

# Layer 2 - can I reach my local gateway's MAC address?
arp -a                              # Linux: ip neigh
# The default gateway should appear with a valid MAC (not 'incomplete')

# Layer 3 - is my IP configuration right, and can I route?
ipconfig /all                       # Linux: ip addr; ip route
ping 10.10.10.1                     # default gateway
tracert 8.8.8.8                     # Linux: traceroute 8.8.8.8

# Layer 4 - is the service port reachable?
Test-NetConnection technaga.com -Port 443   # Linux: nc -vz technaga.com 443

# Layers 5-6 - does the TLS handshake succeed?
openssl s_client -connect technaga.com:443 -servername technaga.com

# Layer 7 - does the application answer correctly?
nslookup technaga.com
curl -v https://technaga.com/

Two rules make this faster:

  • Stop at the first failure. If ping to the gateway fails, there is no point reading application logs yet.
  • A pass at one layer proves the layers below it. If Test-NetConnection to port 443 succeeds, Layers 1 to 4 are working, so you can move straight to TLS and the application.

Microsoft documents every option of Test-NetConnection, including -TraceRoute and -InformationLevel Detailed.

Four troubleshooting cases, mapped to layers

Case 1 (Layer 3/4/7): DNS queries get no reply

A user cannot open any website by name. A packet capture on the client shows the query leaving but no answer coming back:

09:12:44.218321 IP 10.10.20.5.54322 > 8.8.8.8.53: 5234+ A? technaga.com. (32)

Reading it by layer: the source is 10.10.20.5 and the destination 8.8.8.8 (Layer 3), from port 54322 to UDP 53 (Layer 4), asking for the A record of technaga.com (Layer 7). Because the request leaves but nothing returns, test each layer in turn: can the client ping its gateway and route to 8.8.8.8? Is UDP 53 to that resolver blocked by a firewall? In many enterprises, clients are only allowed to use internal resolvers, so the fix is the client’s DNS setting, not a new firewall rule. A healthy exchange looks like this:

09:12:44.218321 IP 10.10.20.5.54322 > 8.8.8.8.53: 5234+ A? technaga.com. (32)
09:12:44.250412 IP 8.8.8.8.53 > 10.10.20.5.54322: 5234 1/0/0 A 104.18.2.161 (48)

Case 2 (Layer 2): The whole network slows to a crawl

During one banking deployment, a technician connected both ends of a patch cable to the same core switch. That created a Layer 2 switching loop, and the resulting broadcast storm took down most of the network. The team first investigated firewall policies and routing, but the evidence was in the switch logs: MAC address flapping between ports and interface utilisation near 100%. Spanning Tree Protocol (STP) with BPDU Guard on access ports is the standard protection against this.

Case 3 (Layer 3/4): A VPN or Zero Trust tunnel connects, then drops

Users report that the Zscaler Client Connector tunnel connects successfully but drops after a few seconds. Authentication logs look clean, so the instinct is to blame identity settings. The real cause is lower down: after tunnel encapsulation adds its own headers, full-size packets exceed the path MTU somewhere in the ISP network and are fragmented or silently dropped.

You can confirm a path MTU problem with a ping that forbids fragmentation, reducing the size until it succeeds:

ping -f -l 1472 8.8.8.8      # Windows: 1472 bytes payload + 28 bytes headers = 1500
ping -M do -s 1472 8.8.8.8   # Linux equivalent

If 1472 fails but a smaller size works, the path MTU is below 1500. Lowering the TCP MSS (a Layer 4 setting) or the tunnel MTU so packets fit the path keeps the session stable. The symptom looked like an application problem. The cause was at Layers 3 and 4.

Case 4 (Layer 6): HTTPS fails for one old client only

A legacy scanner can no longer upload to an internal web server after a security hardening change. Running openssl s_client with an old protocol version reproduces the failure:

openssl s_client -connect app.corp.example:443 -tls1
# handshake failure: server no longer accepts TLS 1.0

The server is behaving correctly: TLS 1.0 and 1.1 were formally deprecated by the IETF in RFC 8996. The right fix is a firmware update for the scanner, not re-enabling old protocols on the server.

OSI layers, attacks and defences

Thinking in layers also helps you build defence in depth: a control at one layer covers gaps in another.

Map of common cyberattacks and matching security controls at each OSI layer
LayerExample attacksExample defences
7 ApplicationSQL injection, DNS tunneling, phishing sitesWAF, secure web gateway, input validation, DNS security
6 PresentationTLS downgrade, weak ciphersTLS 1.2+ only, strong cipher suites, certificate validation
5 SessionSession hijacking, token theftShort session lifetimes, secure cookies, MFA
4 TransportSYN flood, port scanningStateful firewall, SYN cookies, rate limiting
3 NetworkIP spoofing, BGP hijacking, amplification DDoSACLs, anti-spoofing filters, RPKI, DDoS protection
2 Data LinkARP spoofing, MAC flooding, VLAN hoppingDynamic ARP Inspection, DHCP snooping, port security, 802.1X
1 PhysicalCable tapping, rogue devices, jammingLocked racks, disabled unused ports, physical access control

Notice how many controls sit at Layers 2 to 4. That is why network segmentation and properly configured firewalls remain core defences, even as more inspection moves to Layer 7.

Attack scenario showing how an intrusion moves across several OSI layers and where it can be stopped

Common mistakes when using the OSI model

  • Starting at Layer 7. I have seen engineers spend hours reviewing Zscaler Client Connector policies and firewall rules, only to find the user’s Wi-Fi adapter was disabled.
  • Blaming routing for Layer 2 faults. “Cannot reach the server” is often a wrong VLAN on the access port, a duplicate IP address or a stale ARP entry.
  • Treating the model as exact. TLS, ARP, MPLS and tunnels do not fit neatly into one layer. Use the model to organise your thinking, not to win arguments about where a protocol “really” belongs.
  • Testing with ping only. ICMP can be blocked while TCP 443 works, and vice versa. Test the actual port the application uses.

Frequently asked questions

Why learn the OSI model if networks use TCP/IP?

Because it is the shared vocabulary for troubleshooting, vendor documentation and interviews. Its seven-layer split, especially separating Layer 1 from Layer 2, makes it easier to isolate faults than the four-layer TCP/IP model.

At which layer does a firewall work?

Traditional packet-filtering and stateful firewalls work at Layers 3 and 4 (IP addresses, protocols, ports). Next-generation firewalls also inspect Layer 7 to identify applications, users and threats.

At which layer do switches and routers work?

A traditional switch forwards frames by MAC address at Layer 2. A router forwards packets by IP address at Layer 3. A Layer 3 switch does both.

At which layer does DNS work?

DNS is an application-layer (Layer 7) protocol. It normally uses UDP port 53 at Layer 4, and TCP port 53 for large responses and zone transfers.

What is a “Layer 8” problem?

An informal joke for human error: a mistyped configuration, a user clicking a phishing link or an undocumented change. It is not part of the official model, but it causes a lot of real outages.

Conclusion

The OSI model earns its place not as theory but as a checklist. Learn what each layer does, keep the cheat sheet handy, and troubleshoot from the bottom up with one test per layer. You will find faults faster, explain them more clearly to your team, and see where each security control in your network actually fits.

Related TechNaga guides

References

6 thoughts on “OSI Model Explained: The 7 Layers and How to Troubleshoot Each One”

Leave a Comment