The Architecture of the Internet

The TCP/IP Model is the conceptual framework that dictates how data is packaged, addressed, transmitted, routed, and received on a network. It is the practical, simplified successor to the theoretical 7-layer OSI model, stripping it down to 4 highly pragmatic layers.

The 4 Layers of TCP/IP

  1. Application Layer (Layer 4) This is where your software lives. It handles high-level protocols, data representation, and user interfaces. - Protocols: HTTP (Web), SMTP (Email), DNS (Domain Resolution), SSH (Remote Access). - Data Unit: Message / Data. - Example: Your web browser generates an HTTP GET request to fetch a webpage.

  2. Transport Layer (Layer 3) This layer is responsible for end-to-end communication between two host applications. It handles reliability, flow control, and multiplexing (via Ports). - Protocols: TCP (Reliable), UDP (Fast/Unreliable). - Data Unit: Segment (TCP) or Datagram (UDP). - Example: The OS chops the HTTP request into smaller segments and attaches the Source Port (e.g., 54321) and Destination Port (443 for HTTPS).

  3. Internet Layer (Layer 2) This layer is responsible for logical addressing and routing the data across multiple interconnected networks. - Protocols: IP (IPv4 / IPv6), ICMP (Ping). - Data Unit: Packet. - Example: A router inspects the destination IP address attached to the packet and forwards it to the next hop on the internet.

  4. Network Access / Link Layer (Layer 1) The physical and data link components. It handles the actual transmission of raw bits over a physical medium (copper wire, fiber optics, radio waves). - Protocols: Ethernet, Wi-Fi (802.11), ARP. - Data Unit: Frame. - Example: The packet is wrapped in an Ethernet frame with the physical MAC address of the next router and sent over the Wi-Fi card.

Encapsulation

When you send an email, the data travels down the stack. The Application layer creates the message, hands it to Transport which adds a TCP header, hands it to Internet which adds an IP header, hands it to Link which adds an Ethernet header. This is called Encapsulation. When the receiving server gets it, it travels up the stack, stripping away headers until the raw email is delivered to the mail server software.

Each layer adds its own header (and sometimes a trailer). The TCP segment becomes the payload of an IP packet; the IP packet becomes the payload of an Ethernet frame. At each hop, only the relevant layer is inspected: a switch reads the Ethernet frame, a router reads the IP packet, and the destination host reads the TCP header. This layering is why you can swap Ethernet for Wi-Fi without rewriting your browser—the upper layers never have to care what the link medium is.

TCP/IP vs. OSI

The OSI model has seven layers (Physical, Data Link, Network, Transport, Session, Presentation, Application). TCP/IP collapses the top three OSI layers into a single Application layer and merges the bottom two into Network Access. The mapping is useful when reading vendor documentation that uses OSI terminology, but in practice engineers reason in TCP/IP because it reflects how the software is actually written.

Where the Model Breaks Down

The clean four-layer story gets muddy at the edges. TLS sits between the Application and Transport layers, arguably a "Layer 5.5". HTTP/3 runs over QUIC, which is a Transport-layer protocol implemented inside the Application. Modern cloud networking adds overlays (VXLAN, WireGuard) that tunnel one layer's payload inside another. Treat the model as a map, not the territory: it is the fastest way to orient yourself when debugging, but real packets sometimes ignore the neat boundaries.