L3 · NetworksNetworking 101 · part 5 of 7

The OSI Model: Seven Layers, and Why We Only Use Four

The OSI model is networking's best known diagram. Its protocols were never widely used, but its layer names are used everywhere. All seven layers, what actually runs at each one, and how to use them to find problems.

Takumi Yamada
· 9 min read · 2 references
networkingositcp-ipprotocolsfundamentals

Almost every networking course starts with the same seven-row diagram, the OSI (Open Systems Interconnection) model. But no network actually runs it.

The OSI model describes a family of from the 1980s that lost completely to (Transmission Control Protocol)/IP (Internet Protocol). None of its protocols run on your computer today. Even so, engineers use its layer numbers all the time, in sentences like "that's a layer 2 problem", "we need a layer 7 load balancer" and "check layer 1 first".

So the protocols are gone, but the names are used everywhere.

This post covers what the seven layers are, what actually runs at each one, why two of them are almost empty, and how engineers really use the model: as a checklist for finding problems.

Where it came from

In the late 1970s, two groups were trying to set a standard for how computers on different networks talk to each other.

The ISO, the International Organization for Standardization, ran the Open Systems Interconnection project. A committee designed a careful seven-layer plan and wrote the full specification first. At the same time, a less formal group working on ARPANET, the network that grew into the internet, released TCP/IP, with four rough layers. They wrote working code first and the specification afterwards.

By the early 1990s the competition was over. TCP/IP ran the internet, and OSI's own protocols were no longer used.

But the OSI model was good for teaching. It gave every job in a network a named place. So the industry kept the names and dropped the protocols. Today we run TCP/IP protocols and describe them with OSI's layer numbers.

ITS MODEL OF LAYERSITS PROTOCOLSOSIspecification firstSEVEN LAYER NAMESstill how networks are describedOSI PROTOCOLSno longer usedTCP/IPworking code firstFOUR LAYERSwhat is actually builtTCP, IP, UDP …run the internet
The names come from OSI and the protocols come from TCP/IP.

The seven layers

Here they are, from the cable at the bottom to your app at the top.

#LayerJobWhat actually lives here
7ApplicationWhat the data means, , , SMTP
6PresentationData formats, Folded into 7, plus , sort of
5SessionDialogue managementFolded into 7 and 4
4Transport to process deliveryTCP, ,
3NetworkHost to host routing across networksIP, ICMP,
2Data LinkNode to node delivery on one network, Wi-Fi, ,
1Physical on a mediumCables, radio, fibre,

A common way to remember them, from the bottom up, is the sentence "Please Do Not Throw Sausage Pizza Away".

The important idea isn't the number of layers. It's the agreement between them. Each layer does a job for the layer above it, and needs nothing from that layer in return. It also uses the layer below it without knowing how that layer works.

HTTP (Hypertext Transfer Protocol) doesn't know whether it's travelling over fibre or Wi-Fi. Ethernet doesn't know whether it's carrying a web page or a video call. Neither layer needs to know about the other. That's why you can switch from Wi-Fi to a cable in the middle of a download, and the download carries on.

A DOWNLOAD OVER WI-FITHE SAME DOWNLOAD, CABLE PLUGGED INHTTPTCPIPHTTPTCPIPWI-FIETHERNETswappedthese threedo not change
Only the bottom layer was swapped, so the download continues.

Walking up the stack

Layer 1, Physical. This layer turns bits into a physical signal: changes in voltage on a copper wire, flashes of light in a fibre, or radio waves through the air.

If a cable is bent too sharply, a plug is dirty, or a microwave oven is interfering with your Wi-Fi, you have a layer 1 problem, and no software can fix it.

The end of a blue network cable. Its clear plastic plug has eight gold contacts in a row.
A network cable, which belongs to layer 1. The eight gold contacts in the plug carry the signal as changing voltages.Photo: Jonas Bergsten, public domain, via Wikimedia Commons (original). Changes: cropped and resized.

Layer 2, Data Link. This layer delivers frames, which are chunks of data, between devices on the same local network. It finds devices by their MAC address, a 48-bit hardware ID built into every network adapter.

Ethernet and Wi-Fi work at this layer. So do switches, which learn which is connected to which socket, and ARP (Address Resolution Protocol), which answers the question "which device has the 192.168.1.7?" with a MAC address. Layer 2 gets data across one room, one office or one cable. It never gets data across the internet.

A small grey network switch with five network cables plugged into its ports and three ports empty.
A small network switch, which belongs to layer 2. Each cable leads to one device. The switch learns which MAC address is behind each port, and from then on it sends frames for that address only out of that port.Photo: Teoprofe, CC0 1.0, via Wikimedia Commons (original). Changes: resized.

Layer 3, Network. This layer delivers packets between computers on different networks, and finds them by IP address.

This is where routing happens. Each router reads the destination IP address, checks its table, and sends the one step closer. No single device knows the whole route. IP doesn't promise reliable delivery on purpose: packets can be lost, copied or arrive out of order. Promising less is what lets IP work across the whole planet. ping and traceroute are the tools for checking layer 3.

Layer 4, Transport. This layer delivers data to the right program on a machine, not just to the machine. It uses port numbers for that, so it can tell the web on 443 apart from the SSH (Secure Shell) server on port 22.

TCP works at this layer. Its sequence numbers, acknowledgments, resending and speed control all exist to build a reliable stream of on top of layer 3, which isn't reliable. UDP (User Datagram Protocol) also works here, for when speed matters more than reliability. The trade-offs between the two have their own post, TCP vs UDP, and Why It Matters.

IT MOVES AADDRESSED BYWHICH PICKS OUTLAYER 4transportSEGMENT443port numberone process on that machineLAYER 3networkPACKET203.0.113.42IP addressone machine, across networksLAYER 2data linkFRAMEa4:2b:1c:9d:3e:7fMAC addressone device on this network
Layers 2, 3 and 4 each have their own kind of address. Segment is the name for the unit TCP sends.

Layers 5 and 6, Session and Presentation. Textbook diagrams usually don't mention it, but these two layers are almost empty.

The OSI designers planned separate protocols for managing a conversation, such as who talks when and how to pause and continue, and for the form of the data, such as text encodings, compression and encryption. In the TCP/IP world, those jobs never got layers of their own. Applications and libraries at layer 7 took them over, along with the transport at layer 4.

TLS (Transport Layer Security) is the usual example of a protocol that doesn't fit. It encrypts, which is a layer 6 job. It manages sessions, which is a layer 5 job. And it runs on top of TCP and underneath HTTP. Network engineers disagree about which layer TLS belongs to. I think the question has no real answer, because TLS was designed for TCP/IP, not for the OSI model.

Layer 7, Application. These are the protocols that carry what people actually care about. HTTP fetches this page. DNS (Domain Name System) turns names into addresses. SMTP (Simple Mail Transfer Protocol) moves email. SSH gives you a terminal on another machine. Everything below exists so that two programs on opposite sides of the world can talk as if they were directly connected.

Encapsulation: the onion in practice

The layers aren't only an idea. You can see them in every packet, as placed one inside another. This is called encapsulation. When you load a page, the HTTP request is put inside a TCP segment, which is put inside an IP packet, which is put inside an Ethernet .

ONE FRAMEoutermost header firstETHERNETMAC addressesIPIP addressesTCPports, sequenceHTTPGET /SWITCHREADS TO LAYER 2ROUTERREADS TO LAYER 3FIREWALLREADS TO LAYER 4LOAD BALANCERREADS TO LAYER 7
One frame, and how far into it four kinds of device read.

Each device on the way reads only as many headers as its job needs. A switch reads only the Ethernet header, so it works at layer 2. A router also reads the IP header, so it works at layer 3. A firewall usually reads the port numbers too, so layer 4. A layer 7 load balancer reads all the way into the HTTP request, and can send it to a server based on the (Uniform Resource Locator) itself.

That's also how network devices are classified. The layer a device is named after is the deepest header it reads.

The frame is the part that gets replaced at every step. The IP packet keeps its destination address from your laptop all the way to the server. Its sender address usually changes once, at your home router, which replaces your laptop's private address with your home's public one. That's (Network Address Translation), explained in How Your Home Network Actually Works. Each link on the way also wraps the packet in a new layer 2 frame, just for that link: a Wi-Fi frame to your router, an Ethernet frame to your (Internet Service Provider), and fibre frames across the long-distance links.

laptop to routerWI-FIframeIP PACKETlaptop → serverrouter to ISPETHERNETframeIP PACKETlaptop → serveracross the backboneFIBREframeIP PACKETlaptop → servera new frame for each link, and the same IP packet inside all three
Three links from the path. The solid block is the part that is rebuilt on each one.

OSI versus TCP/IP: the mapping

The model you actually use has four layers, and they line up with OSI's seven like this.

OSIthe seven namesTCP/IPthe four that run7APPLICATION6PRESENTATION5SESSION4TRANSPORT3NETWORK2DATA LINK1PHYSICALAPPLICATIONHTTP, TLS, DNSTRANSPORTTCP, UDPINTERNETIPLINKEthernet, Wi-Fi
Layers 5 and 6 are dashed because nothing in a TCP/IP stack lives there.

When a network engineer says "layer 7", they mean the TCP/IP application layer. When they talk about "layer 2 or layer 3 switching", they are using OSI numbers to describe TCP/IP equipment. The industry uses both models at once. We build with four layers and describe them with seven numbers.

You may also hear about an unofficial layer 8, which means the user. Calling something "a layer 8 problem" means the network is fine and the cause is in how it's being used. It's a joke at the user's expense, so it's better to recognize it than to repeat it.

The model as a debugging checklist

This is what the OSI model is really useful for today. It turns "the internet is broken" into a search in a fixed order.

Start at the bottom and work up, because a layer can't work if the layer below it is broken.

  1. Layer 1. Is there a connection at all? Is the cable plugged in and the link light on, or is the Wi-Fi connected? Does ip link show the network adapter as up?
  2. Layer 2. Can you reach the local network? Does ip neigh show your router's MAC address? If ARP fails, no device on the local network is answering.
  3. Layer 3. Can packets get further? Ping your router, then ping 1.1.1.1. If the router answers and the internet doesn't, the problem is in routing or at your ISP. traceroute shows where the path stops.
  4. Layer 4. Is the port open? If ping works but the service doesn't, nc -zv host 443 shows whether anything is listening, or whether a is silently dropping your connection.
  5. Layer 7. Is the application working? curl -v shows the DNS lookup, the TLS and the HTTP status. That's the top of the stack, visible with one command.
7APPLICATIONis the application working?curl -v4TRANSPORTis the port open?nc -zv host 4433NETWORKcan you route?ping, traceroute2DATA LINKcan you reach the local network?ip neigh1PHYSICALis there a link at all?ip linkstart at the bottom
The checklist above as a stack. Start at layer 1 and go up until something fails.

For example, if ping works but the site doesn't, the problem is above layer 3. If nothing answers a ping but the link light is on, the problem is at layer 2 or 3. I think checking from the bottom up like this is the most useful habit the seven-row diagram gives you.

My Take

The OSI model is unusual. It failed as a standard and became essential anyway.

I don't think about session layers when I write Go services. But every time a can't reach its , I check the same things in the same order: link, ARP, ping, port, protocol. The layer numbers give the whole industry a shared way to talk about that search.

Learn the seven names, understand the four layers that actually run, and check them from the bottom up.

To see the layers in action, How the Internet Delivers a Packet follows one (Hypertext Transfer Protocol Secure) request through the whole stack. How Your Home Network Actually Works happens almost entirely at layers 2 and 3. And How a VPN Actually Works shows what happens when you deliberately put one packet inside another.

Check yourself

3 questions · nothing is saved
  1. 1.Which two layers are almost empty in the TCP/IP world?
  2. 2.Why is a switch called a layer 2 device?
  3. 3.Ping to your router works, but ping to 1.1.1.1 doesn't. Where does the problem start?

References & Primary Sources

Official specifications, standards, and documentation cited in this post.

  1. [1]

    The original seven-layer reference model defined by ISO and CCITT/ITU-T.

    STANDARDiso.org
  2. [2]

    Defines the 4-layer architectural model (Link, IP, Transport, Application) that actually powers the internet.

    RFCrfc-editor.org

Who wrote this

Author profile and background

Takumi Yamada

Takumi Yamada

· Backend Engineer

Backend engineer building services, databases, Linux tooling, and NEGEN SYSTEMS. Writing about low-level mechanics, distributed systems, and real-world security.

End of post
NEGEN SYSTEMS
Receipt · post 8 of 31
Written
Dec 22, 2025
Length
1,883 words · 9 min
Built
…
Served by
…
Delivered
…
Over the wire
…
Go's share
…
Next in Networking 101 · part 6 of 7

How a VPN Actually Works

A VPN puts each of your packets inside an encrypted envelope and gives it a new return address. Here's the tunnel, the encryption, and what a VPN does and doesn't protect.

5 min read
From other series