A network request depends on many different mechanisms. Applications create messages, transport protocols deliver data between processes, routers move packets between networks, and network interfaces transmit signals across a physical medium.
Describing all of this as "the network" hides the responsibility of each component. The OSI model separates network communication into seven layers so that each responsibility has a clear place.
OSI stands for Open Systems Interconnection. The International Organization for Standardization developed the model as a common framework for describing how different systems communicate. It remains useful as a vocabulary for protocol design, architecture discussions, and troubleshooting.
The OSI model is a reference model. Real internet protocols do not always fit its boundaries exactly, and software does not execute a seven-step OSI program for every message. The model gives engineers a structured way to reason about communication even when an implementation combines several layers.
Sending data between two applications involves several independent problems:
A single protocol could attempt to solve every problem. Such a design would tightly couple application behavior to transport rules, routing, hardware, and signal transmission. Replacing one part would require changes throughout the system.
Layering separates these concerns. Each layer provides a service to the layer above it and relies on the layer below it.
For example, an HTTP client can ask a transport service to carry bytes without deciding how routers forward packets. A router can forward IP packets without understanding whether their contents represent an HTML page, an email, or a database query. An Ethernet interface can transmit a frame without understanding the route to the final server.
This separation provides three practical benefits.
Independent evolution: A web application can move from Ethernet to WiFi without changing the meaning of its HTTP requests. The lower layer changes while the higher-layer behavior remains stable.
Interoperability: Vendors can implement the same protocol specifications on different hardware and operating systems. Devices can communicate as long as they agree at the relevant boundaries.
Failure isolation: An engineer can distinguish a broken cable from a missing route, a closed port, a failed TLS handshake, or an invalid HTTP response.
The OSI stack is numbered from the physical medium at Layer 1 to application protocols at Layer 7.
The following table provides a compact map of the layers. The protocol examples show common associations rather than rigid ownership.
| Layer | Name | Main Responsibility | Common Examples | Data Unit |
|---|---|---|---|---|
| 7 | Application | Network services and application messages | HTTP, DNS, SMTP, SSH | Data or message |
| 6 | Presentation | Data representation, encoding, compression, encryption | UTF-8, JSON encoding, TLS concepts | Data |
| 5 | Session | Establishing and managing logical conversations | Checkpoints, dialogue control, session state | Data |
| 4 | Transport | Process-to-process delivery | TCP, UDP | Segment or datagram |
| 3 | Network | Logical addressing and routing between networks | IPv4, IPv6, ICMP | Packet |
| 2 | Data Link | Delivery between nodes on the same link | Ethernet, WiFi, VLANs | Frame |
| 1 | Physical | Sending raw bits as physical signals | Copper, fiber, radio | Bits |
Terms such as message, segment, packet, and frame describe a protocol data unit, or PDU, at a particular layer. Engineers sometimes use "packet" as a general word for network data, but the OSI terminology makes the layer explicit.
Loading simulation...
Two kinds of communication occur in a layered system.
Vertical communication happens inside one host. A layer receives a service from the layer below it and provides a service to the layer above it.
Peer communication is the logical exchange between the same layer on two hosts. The HTTP implementation on a client follows the same HTTP rules as the server. The TCP implementation on one host exchanges transport information with TCP on the other host.
Peer layers do not usually send data directly to each other. Data moves down the sender's stack, crosses the network, and moves up the receiver's stack.
As data moves downward, each relevant layer adds control information for its peer. A transport header can contain port information. A network header contains logical addresses. A data-link header contains information needed for the current link.
The receiving host processes this information in reverse. Its data-link layer accepts a frame, its network layer processes the packet, its transport layer delivers data to the correct process, and its upper layers interpret the application message.
This arrangement lets each layer focus on its own scope. The following sections examine those scopes from Layer 7 down to Layer 1.
The Application layer provides network services used by application software. It defines the meaning and structure of messages exchanged by programs.
Common Layer 7 protocols include:
An application protocol defines operations, message fields, valid responses, and error behavior. HTTP, for example, defines methods such as GET and POST, headers such as Content-Type, and status codes such as 200 and 404.
The application itself and the Application layer are related but different concepts. A browser contains rendering, storage, user-interface, and JavaScript features that have no direct OSI role. Its HTTP client is the part that participates in an application-layer protocol.
Consider an API request:
At Layer 7, the meaningful questions concern the requested resource, HTTP method, headers, authentication, and response status. IP routes and Ethernet addresses do not change the meaning of this request.
Layer 7 failures include malformed messages, unsupported operations, authentication errors, application timeouts, and responses with error status codes. A client can reach the server successfully at the lower layers and still receive an application-layer failure.
The Presentation layer handles the representation of data. Two applications must agree on how bytes correspond to text, numbers, structured objects, images, or encrypted content.
Its conceptual responsibilities include:
Consider the JSON value:
The sender converts that structured value into bytes using an agreed encoding. The receiver interprets the bytes using the same rules. If one side expects UTF-8 JSON while the other sends an incompatible binary format, transport can deliver every byte correctly and the application can still fail to interpret the message.
TLS is often associated with Layer 6 because it encrypts and authenticates application data. In the deployed internet stack, TLS sits between an application protocol and its transport and does not fit one OSI layer perfectly. The Layer 6 association describes its data-protection function rather than a strict implementation boundary.
Presentation failures include invalid text encoding, unsupported compression, failed certificate validation, decryption errors, and incompatible serialization formats.
The Session layer manages logical conversations between applications. A session can outlive a single message and may contain state about an ongoing interaction.
Its conceptual responsibilities include:
A large file transfer illustrates checkpointing. If the participants record progress after every completed portion, they may resume from the latest checkpoint instead of starting from byte zero after a disconnection.
A session is not automatically the same as a TCP connection. An authenticated web session may continue across several TCP connections through a cookie or token. A single long-lived connection may also carry several independent application conversations.
Modern internet applications commonly implement session behavior in application libraries and protocols rather than through a separate, universal Session-layer protocol. Layer 5 still provides useful language for authentication sessions, RPC conversations, database sessions, and resumable exchanges.
Session-level failures include expired session state, invalid resume information, mismatched conversation identifiers, and failures to re-establish an interrupted exchange.
The Transport layer delivers data between processes running on endpoint hosts.
IP addressing gets data to a host. Transport addressing, commonly represented by port numbers, identifies the destination process or socket on that host.
For example:
The server address identifies the host, while port 443 identifies the listening service. The client's temporary port allows the operating system to deliver returning data to the correct client socket.
TCP and UDP provide different transport services.
TCP provides an ordered byte stream. It establishes connection state, detects missing data, retransmits when needed, controls the sender's rate, and delivers bytes to the application in order.
UDP sends independent datagrams without establishing TCP-style connection state. It does not provide built-in retransmission, ordering, or stream delivery. Applications and higher-level protocols can add the behaviors they require.
Transport protocols may divide application data into smaller units for delivery. On the receiving host, the transport layer directs the data to the correct socket.
A Layer 4 failure can appear as a connection timeout, connection refusal, reset connection, transport retransmissions, or an unreachable UDP service. The server may have a valid IP route while no process listens on the requested port.
The Network layer moves packets between networks. It provides logical addressing and routing beyond one local link.
IPv4 and IPv6 are the main Layer 3 protocols on the internet. An IP packet contains source and destination IP addresses. Routers examine the destination address and select a next hop based on their routing information.
Each router handles one portion of the path. It does not need a complete map of the physical route before forwarding a packet. It selects the next hop that best matches the destination according to its routing table.
Layer 3 also includes control and diagnostic behavior. ICMP communicates information such as destination errors and hop-limit expiration. Tools such as ping and traceroute depend on Layer 3 behavior, although firewalls can block or limit their messages.
Layer 3 does not guarantee that packets arrive, arrive once, or arrive in order. Higher layers decide whether they need those properties.
Layer 3 failures include missing routes, incorrect IP configuration, address conflicts, expired hop limits, and filtering based on IP addresses.
The Data Link layer delivers frames between nodes on the same link or local network segment.
Ethernet and WiFi are common Layer 2 technologies. They define framing, local addressing, access to the transmission medium, and error detection for a single link.
Ethernet commonly uses MAC addresses to identify interfaces on a local network. A switch learns which MAC addresses are reachable through its ports and forwards frames toward the appropriate port.
Layer 2 delivery has a smaller scope than Layer 3 routing. When a laptop sends an IP packet to a remote server, its first Ethernet or WiFi frame normally targets the local gateway. The gateway removes that frame, processes the IP packet, and creates a different frame for the next link.
A frame commonly contains:
Virtual LANs, or VLANs, also operate at Layer 2. They let network administrators create separate logical local networks over shared switching infrastructure.
Layer 2 failures include an incorrect VLAN, a switch-port problem, a missing local neighbor mapping, excessive frame errors, and a loop or forwarding problem within the local network.
The Physical layer transmits raw bits over a physical medium. It defines how a 0 or 1 is represented as an electrical, optical, or radio signal.
Layer 1 covers:
An Ethernet cable, fiber-optic link, or WiFi radio carries symbols that the receiving hardware converts into bits. Layer 1 does not interpret IP addresses, ports, or application messages.
Repeaters and traditional hubs operate primarily at this layer. They regenerate or repeat signals without making forwarding decisions based on frames or packets. Modern network interfaces also contain a physical component, often called the PHY, that handles signal transmission and reception.
Layer 1 failures include disconnected cables, damaged connectors, incompatible transceivers, weak wireless signals, interference, and failed link negotiation. No higher-layer protocol can compensate for a link that cannot carry usable bits.
Each layer treats the information from higher layers as its payload and adds the control information needed for its own task.
For an HTTPS request carried over TCP and Ethernet, the flow can be represented as:
The receiver performs the reverse operation. Each layer validates and removes the information intended for it, then passes the remaining payload upward.
The boundaries do not always align one-to-one. One application message may span several transport units, and one transport unit may be split or processed differently along the path. The OSI view describes responsibilities rather than fixed byte sizes.
Network devices are often described by the highest layer they inspect when making a decision.
A Layer 2 switch forwards frames using link-layer information such as MAC addresses and VLAN tags.
A Layer 3 router forwards packets using IP addresses and routing tables.
A Layer 4 firewall or load balancer can make decisions using IP addresses, transport protocols, ports, and connection state.
A Layer 7 proxy or load balancer can understand application information such as an HTTP hostname, path, method, or header.
These labels describe behavior, not a permanent property of the hardware. A single device can perform switching, routing, transport filtering, TLS termination, and HTTP proxying. A modern network interface can also process parts of Layers 2, 3, and 4 in hardware.
The layer label answers a practical question: what information must the device inspect to perform this function?
Consider an API client that cannot retrieve:
A layer-based investigation narrows the failure instead of treating the network as one component.
Check whether the network interface has a link, whether WiFi is associated, and whether the device can transmit and receive. A disconnected cable or unusable wireless signal is a Layer 1 problem.
Confirm that the interface belongs to the expected local network and can reach its gateway at Layer 2. Incorrect VLAN membership or local frame-delivery problems prevent traffic from leaving the local segment.
Check the client's IP configuration, default route, and ability to reach the destination network. An absent route or blocked Layer 3 path prevents packets from reaching the server.
Confirm that the destination port accepts the intended transport protocol. A TCP connection refusal usually means the host responded but no service accepted that port, or a firewall rejected it. A timeout may indicate dropped traffic, a failed route, or an unresponsive endpoint.
If the transport connection succeeds, inspect TLS certificate validation, protocol negotiation, and any session-establishment behavior. A certificate hostname mismatch belongs above basic transport connectivity.
Once the secure channel works, inspect the HTTP request and response. A 401 response points to application authentication. A 404 response points to resource selection or routing at the application layer. A 500 response indicates that the server accepted the request but failed while processing it.
The investigation can also proceed from the top down when evidence starts with an application error. The value of OSI comes from separating the questions. Successful Layer 3 reachability does not prove that a Layer 4 port is open, and a successful TCP connection does not prove that TLS or HTTP will succeed.
The OSI model presents clean boundaries. Deployed protocols often combine responsibilities or place them at different levels.
TLS protects application data while using a transport protocol, so engineers commonly place it between Layers 4 and 7 or associate it with Layers 5 and 6.
QUIC runs over UDP but provides encryption, reliable streams, flow control, and congestion control. Its responsibilities cross the boundaries that would traditionally separate transport, session, and presentation behavior.
Tunnels add another complication. A VPN can place one network-layer packet inside another packet. The same data can therefore have an inner and outer set of headers associated with different parts of the path.
Middleboxes can also inspect several layers. A firewall may filter by IP address and port, while a proxy may terminate TLS and route by HTTP path.
These examples do not make the OSI model obsolete. They show why it should function as a classification tool rather than a rule that every protocol must fit into one box. When a protocol crosses layers, describe the specific responsibilities it performs.
The OSI model divides communication into seven layers. From top to bottom, they cover application services, data encoding, compression and protection, session management, process-to-process delivery, addressing and routing between networks, frames across a local link, and physical signals.
Data moves down the sender's stack and up the receiver's stack. Each layer serves the one above it and communicates logically with its counterpart on the remote host.
Real protocols do not always fit the boundaries perfectly, but the model remains a useful vocabulary for assigning responsibilities and isolating failures.
The OSI model turns a vague network problem into a set of specific, testable layers.
5 quizzes