ByteTools

The OSI Model: 7 Layers Explained

Updated 2026-11-04

The OSI model splits network communication into seven layers, from the physical cable (layer 1) to the application (layer 7). Each layer has one job and talks only to the layers directly above and below it. The model is a teaching and troubleshooting tool; the real internet uses the simpler four-layer TCP/IP model.

The seven layers

Data is passed down the layers on the sending side, and each layer adds its own header. This is called encapsulation. The receiver removes the headers in the opposite order. The unit of data at each layer is called a PDU (protocol data unit).

LayerNamePDUExample protocolsTypical devices
7ApplicationDataHTTP, DNS, SMTP, SSHProxy, application firewall
6PresentationDataTLS (partly), character encodings, MIME-
5SessionDataRPC, NetBIOS session, TLS (partly)-
4TransportSegment (TCP) or datagram (UDP)TCP, UDPFirewall, load balancer
3NetworkPacketIP, ICMP, OSPFRouter, layer 3 switch
2Data linkFrameEthernet, Wi-Fi (802.11), ARPSwitch, access point
1PhysicalBitEthernet cabling, fiber, radioCable, hub, repeater

OSI compared with TCP/IP

The TCP/IP model has four layers and matches how protocols were really built. The mapping is approximate:

TCP/IP layerOSI layers
Application7, 6, 5
Transport4
Internet3
Link (network access)2, 1

Some books show TCP/IP with five layers, splitting the link layer into data link and physical. In daily work people still say "layer 2 switch" or "layer 7 firewall" using OSI numbers, so it is useful to know both.

What happens when you open a website

Imagine you type https://example.com in your browser.

  1. Layer 7: the browser needs an address, so it sends a DNS query for example.com. Later it sends an HTTP request.
  2. Layer 6/5: a TLS handshake negotiates encryption keys and checks the server certificate.
  3. Layer 4: TCP opens a connection to port 443 with a three-step handshake (SYN, SYN-ACK, ACK) and splits the data into segments.
  4. Layer 3: IP puts the source and destination addresses into packets. Routers forward them hop by hop.
  5. Layer 2: on each link, the packet is placed in a frame with MAC addresses. ARP finds the MAC address of the next hop on IPv4 networks.
  6. Layer 1: the frame becomes electrical signals, light pulses or radio waves.

On the server, the same steps run in reverse order, from layer 1 up to layer 7.

Which layer does each tool test?

Each network check proves that the layers up to a certain point work. The table shows where our tools fit.

ToolLayerWhat it proves
Ping3 (ICMP)The host is reachable at the IP level and how long a round trip takes
Traceroute3Which routers are on the path and where delay or loss starts
Port checker4 (TCP)A TCP connection to a given port can be opened
SSL checker6/5, over 4The TLS handshake works and the certificate is valid
HTTP headers7The web server answers and which status and headers it sends
DNS checker7Name servers return the expected records

Three details need care:

  • TLS does not fit one layer. In the OSI model it is often placed at layer 6 (encryption and presentation), sometimes at layer 5 (session). In the TCP/IP model it is simply part of the application layer, running on top of TCP. For troubleshooting, it is enough to know that TLS works after TCP and before HTTP.
  • Ping can fail on a working host. Many firewalls drop ICMP echo requests. A failed ping does not always mean the host is down, so check the port as well. Also, traceroute uses the TTL field in IP packets and ICMP time-exceeded replies, and some routers do not answer, which shows as a gap in the output.
  • DNS runs on layer 7 even though it is needed before everything else. It normally uses UDP port 53, and TCP port 53 for large answers and zone transfers.

Troubleshooting bottom-up

A reliable method is to start at layer 1 and move upward. Each step removes a whole group of possible causes.

  1. Layer 1: Is the cable connected, the Wi-Fi on, the link light lit?
  2. Layer 2: Does the device have a link to the switch or access point? Is the VLAN right? Check for duplicate MAC addresses or a wrong Wi-Fi password.
  3. Layer 3: Does the device have a valid IP address, mask and gateway? Can it ping the gateway, then an outside address such as 192.0.2.1? Use traceroute if the path fails halfway. See what an IP address is and subnetting for common addressing mistakes.
  4. Layer 4: Is the port open and not blocked by a firewall? See well-known ports.
  5. Layers 5-6: Does the TLS handshake succeed? Look for an expired certificate, a wrong name or an unsupported protocol version.
  6. Layer 7: Does the name resolve, and does the application return a correct response?

In practice, you can also work top-down or split the problem in the middle: if a port check works, layers 1 to 4 are fine, and you can focus on the application.

Related guides