Loading learning content...
We've explored why networks are layered, how layers are designed as modules, what interfaces exist between them, and how peer communication works. Now it's time to answer the fundamental question: What does each layer actually do?
Each layer in the network stack has specific responsibilities—functions it performs that no other layer handles. Understanding these functions is essential for network design, troubleshooting, and knowing which protocols operate where. This page provides a comprehensive overview of layer functions, setting the stage for deep dives into each layer in subsequent chapters.
By the end of this page, you will understand the primary functions of each network layer: physical transmission, framing and error detection, addressing and routing, reliable delivery and flow control, and application-level services. You'll see how these functions combine to enable end-to-end communication.
The Physical Layer (Layer 1) is responsible for the actual transmission of raw bits over a physical medium. It deals with the hardware, electrical, optical, and mechanical aspects of network interfaces.
Primary functions:
| Medium | Standard | Speed | Key Physical Specs |
|---|---|---|---|
| Twisted Pair | 1000BASE-T | 1 Gbps | Cat5e/Cat6, RJ-45, 4 pairs, PAM-5 signaling |
| Fiber (Multi-mode) | 10GBASE-SR | 10 Gbps | 850nm laser, OM3/OM4 fiber, LC connectors |
| Fiber (Single-mode) | 100GBASE-LR4 | 100 Gbps | 4x25Gbps WDM, 1310nm, up to 10km |
| WiFi | 802.11ax (WiFi 6) | 9.6 Gbps max | 2.4/5/6 GHz, OFDMA, 1024-QAM |
| Cellular | 5G NR | 10+ Gbps | mmWave/sub-6GHz, massive MIMO |
Physical layer issues (bad cables, signal interference, hardware failures) affect everything above. A faulty cable causes packet loss that appears as TCP retransmissions, slow HTTP responses, and frustrated users. Always check Layer 1 first when diagnosing severe, intermittent issues.
The Data Link Layer (Layer 2) transforms the raw bit stream into a reliable link between adjacent network nodes. It handles framing, addressing within a network segment, and error detection.
Primary functions:
The two sublayers:
The Data Link Layer is often divided into two sublayers:
LLC (Logical Link Control):
MAC (Media Access Control):
Switching at Layer 2:
Switches operate at Layer 2, learning MAC addresses and forwarding frames only to the relevant port. This creates collision domains per port (improving performance) and enables efficient local network operation.
Layer 2 defines broadcast domains—all devices that receive broadcast frames. A switch keeps unicast traffic local but floods broadcasts. VLANs segment large networks into smaller broadcast domains, improving performance and security.
The Network Layer (Layer 3) enables communication across different networks—the inter-networking that gives us the 'Internet.' It handles logical addressing, routing, and packet forwarding.
Primary functions:
| Protocol | Function | Key Features |
|---|---|---|
| IPv4 | Datagram delivery | 32-bit addressing, TTL, fragmentation, header checksum |
| IPv6 | Next-gen datagram delivery | 128-bit addressing, flow labels, extension headers, no fragmentation by routers |
| ICMP | Control and error reporting | Ping (echo), traceroute (TTL exceeded), destination unreachable |
| OSPF | Interior gateway routing | Link-state routing, Dijkstra's algorithm, fast convergence |
| BGP | Exterior gateway routing | Path-vector routing, policies, Internet backbone |
| ARP | Address resolution (L3→L2) | Map IP addresses to MAC addresses on local network |
Key insight: Best-effort delivery
IP provides best-effort delivery—packets are forwarded toward their destination with no guarantee of:
This simplicity is deliberate. By keeping IP simple, routers can be fast. Reliability is pushed to higher layers (TCP) where end hosts can handle it without burdening the network core.
The narrow waist:
IP is the 'narrow waist' of the Internet architecture:
This universality is why the Internet scales—any device speaking IP can communicate with any other device speaking IP, regardless of physical network technology.
Routing and forwarding are often confused. ROUTING is the control-plane process of building routing tables (done by routing protocols, potentially taking seconds). FORWARDING is the data-plane process of moving each packet through the router (done at nanosecond scale). Routers do both, but they're very different operations.
The Transport Layer (Layer 4) provides end-to-end communication services for applications. It transforms the network's best-effort delivery into the reliable (or unreliable, for UDP) byte stream that applications expect.
Primary functions:
The end-to-end principle in action:
Transport layer exemplifies the end-to-end principle:
This keeps routers simple and fast while enabling sophisticated features where they can be done correctly—at the communicating ends.
Emerging transports:
QUIC (Quick UDP Internet Connections) is a new transport protocol running over UDP that provides:
QUIC is used by HTTP/3 and represents the evolution of transport layer thinking.
The Session Layer (Layer 5 in OSI model) manages dialog control and synchronization between applications. In the TCP/IP model, these functions are typically absorbed by the application layer, but they remain conceptually important.
Primary functions (conceptual):
Where session functions appear in TCP/IP:
Though TCP/IP doesn't have a distinct session layer, session concepts appear in:
| Function | TCP/IP Implementation |
|---|---|
| Session ID | HTTP cookies, JWT tokens |
| Session state | Application database, servers's session stores |
| Dialog control | Application protocol (RPC request/response) |
| Synchronization | Application-level checkpointing |
| Authentication | TLS client certificates, application login |
| Session timeout | Application-configured timeouts |
Examples:
The OSI session layer is often criticized as unnecessary—its functions either fold into transport (TCP connections are sessions) or into applications (cookies for HTTP sessions). But the CONCEPTS remain valuable: understanding session establishment, checkpointing, and dialog control helps design robust applications, even if there's no dedicated protocol layer.
The Presentation Layer (Layer 6 in OSI model) handles data representation—ensuring that data sent by one application can be understood by another, regardless of internal formats.
Primary functions (conceptual):
| Function | OSI Concept | TCP/IP Implementation |
|---|---|---|
| Serialization | Data translation | JSON, XML, Protocol Buffers, MessagePack |
| Encryption | Data security | TLS, S/MIME, PGP (application layer) |
| Compression | Data compression | gzip, brotli (in HTTP), codec negotiation |
| Character encoding | Character set handling | Content-Type: charset=UTF-8 (HTTP header) |
| Media encoding | Data formatting | H.264/H.265 video, AAC/Opus audio, JPEG/PNG images |
Modern manifestations:
TLS (Transport Layer Security): Despite its name suggesting transport layer, TLS provides presentation-layer functions:
Content negotiation (HTTP):
Accept: application/json — Request JSON data formatAccept-Encoding: gzip, br — Request compressed responseAccept-Language: en-US — Request English contentContent-Type: text/html; charset=utf-8 — Indicate encoding and formatSerialization formats: JSON, Protocol Buffers, and other serialization formats handle the 'presentation' of structured data—converting between in-memory objects and byte streams for transmission.
Why presentation matters:
Without proper presentation handling:
The Application Layer (Layer 7) provides network services directly to end-user applications. It's where network capabilities become useful functionality—web browsing, email, file transfer, and countless other services.
Primary functions:
| Protocol | Purpose | Transport | Key Features |
|---|---|---|---|
| HTTP/HTTPS | Web content transfer | TCP (or QUIC) | Request/response, methods, headers, stateless |
| DNS | Name resolution | UDP (TCP for large) | Query/response, hierarchical, caching |
| SMTP | Email transfer | TCP | Commands (MAIL, RCPT, DATA), relay |
| IMAP/POP3 | Email retrieval | TCP | Mailbox access, message management |
| FTP/SFTP | File transfer | TCP | Separate control/data connections, directory ops |
| SSH | Secure remote access | TCP | Encrypted terminal, tunneling, file transfer |
| DHCP | Network configuration | UDP | Lease IP addresses, broadcast-based |
| NTP | Time synchronization | UDP | Clock sync, stratum hierarchy |
Application layer is where users live:
Every user interaction with a network ultimately manifests at the application layer:
google.com → DNS query + HTTP requestThe API to applications:
Application protocols define how software communicates over networks. When you use:
curl https://api.example.com/data — You're using HTTP at application layerfetch() in JavaScript — Same HTTP, different interfaceModern trends:
The application layer is where all other layers' work becomes meaningful. Physical bits become Ethernet frames become IP packets become TCP segments—all so that an HTTP request can reach a web server and your browser can display a page. The entire stack exists to serve application layer communication.
We've completed our exploration of layered architecture by examining what each layer actually does. Let's consolidate the key insights:
| Layer | Primary Function | Key Concepts | Example Protocols |
|---|---|---|---|
| Physical | Bit transmission | Signaling, encoding, connectors | Ethernet PHY, 802.11 PHY |
| Data Link | Frame delivery on local network | MAC addressing, framing, error detection | Ethernet, WiFi, PPP |
| Network | Packet delivery across networks | IP addressing, routing, fragmentation | IP, ICMP, OSPF, BGP |
| Transport | End-to-end communication | Port multiplexing, reliability, flow control | TCP, UDP, QUIC |
| Session | Dialog management | Session state, synchronization | (App layer in TCP/IP) |
| Presentation | Data representation | Encoding, encryption, compression | TLS, JSON, media codecs |
| Application | Network services | Application protocols, resources | HTTP, DNS, SMTP, SSH |
Module Complete:
Congratulations! You've completed Module 1: Layered Architecture. You now understand:
This foundation prepares you for the remaining modules on network models: OSI Model, TCP/IP Model, and their comparison.
You now have a comprehensive understanding of layered network architecture—the foundational organizing principle that makes the Internet possible. As you study specific protocols and technologies, always consider which layer they occupy, what service they provide, and how they interact with layers above and below.