Application data is wrapped as it moves down the networking stack. Each layer adds information required for its job, and the receiver removes that information in reverse. This is encapsulation.
What Is a Network Packet?
HTTP data -> TLS records -> TCP segments -> IP packets -> Ethernet or Wi-Fi frames -> Signals
What a Packet Carries
At the IP layer, a packet contains source and destination information plus a transport payload. That payload may hold part of a TCP stream or a UDP datagram. Real headers contain more fields, but source, destination, protocol, lifetime, and payload are the useful starting concepts.
The envelope analogy explains headers and payload, but traffic is nested: an Ethernet frame can carry an IP packet, which carries a TCP segment, which carries TLS-protected HTTP bytes.
The Simplified Layer Model
- Application
- HTTP, DNS, SSH, MQTT, and similar protocols define meaning.
- Transport
- TCP or UDP identifies ports and provides transport behavior.
- Network
- IP provides addressing and routing across networks.
- Local link
- Ethernet or Wi-Fi moves frames across the current segment.
- Physical
- Copper, fiber, and radio carry encoded signals.
MAC and IP Addresses Have Different Scope
A MAC address is used on a local link. An IP address is used across routed networks. When a laptop contacts a distant server, the IP destination can remain that server while the local frame is addressed to the MAC address of the next hop—usually the default gateway. A new link-layer frame is created at each routed link.
Switches and Routers
A switch connects devices within a local Ethernet network. It learns which MAC addresses are reachable through its ports and forwards frames accordingly. A router connects IP networks, examines destination IP addresses, and selects the next route for packets.
Routers, Switches, Gateways, and NAT
Local and routed forwarding
PC -> switch -> printer on the same networkPC -> switch or Wi-Fi -> default gateway for a remote networkGateway -> ISP -> internet routers -> destination networkDefault Gateways and TTL
If no more specific route matches, a host sends the packet toward a default gateway. Each router needs a suitable next hop rather than knowledge of the complete physical path. The packet's TTL acts as a hop limit; routers decrement it and discard the packet at zero so routing loops cannot circulate forever.
Follow the scope
MAC gets a frame across the current link. IP and routers move a packet across networks. Transport ports deliver its contents to the correct endpoint service.
Series
How Internet Requests Actually WorkAn eight-part beginner series tracing internet communication from an HTTP request through DNS, IP, ports, transport protocols, packets, network devices, server infrastructure, security, and troubleshooting.
HTTP Requests: Methods, URLs, Headers, and Bodies
Start at the application layer and understand what a browser or API client is actually asking for.
DNS, Domain Names, and IP Addresses
Follow the lookup that turns a human-friendly hostname into a network destination.
Public IP, Private IP, NAT, and Ports
See how local devices reach the internet and how operating systems identify each service and flow.
TCP vs UDP
Compare reliable byte streams with simpler datagrams and understand where each transport fits.
Packets, Network Layers, Switches, and Routers
Learn how data is encapsulated and moved across local links and routed networks.
The Complete Website Request Journey
Put the layers together from the browser to production infrastructure and back again.
HTTPS, TLS, and HTTP Status Codes
Understand secure transport, certificate checks, and the response codes used during debugging.
Troubleshooting, Localhost, Cloud, and Containers
Apply the model with diagnostic tools and carry it into cloud and container environments.
Nikhlesh Yadav is a Technical Lead and Solution Architect with 12+ years of experience across cloud-native systems, distributed platforms, AI integrations, Web3, and cyber security.
Read full profile