Computer Basics

How Data Travels on the Internet: Packets, Routing, and Protocols Explained

Data travels on the Internet as discrete units called packets, each independently routed through networks using IP addressing and BGP. A single web page request typically generates 50–100 packets, each taking its own path across the Internet before being reassembled at the destination. This guide explains packet switching, packet structure, IP routing, TCP versus UDP, the OSI model, and how a complete web request travels from browser to server and back.

What Is Packet Switching?

Packet switching is the method by which all Internet data is transmitted. Each data stream — a web page, video, file download — is divided into small, fixed-size units called packets before transmission. Each packet is routed independently through the network and reassembled in the correct order at the destination.

Packet switching replaced circuit switching (used in traditional telephone networks, where a dedicated line was reserved end-to-end for each call). Packet switching allows many conversations to share the same physical links simultaneously, making vastly more efficient use of network bandwidth. If one path becomes congested or fails, individual packets can be routed around it — the connection does not break as it would in a circuit-switched network.

Packet Structure

Each IP packet consists of a header, payload, and in some implementations a trailer. The IPv4 header is a minimum of 20 bytes; IPv6 headers are a fixed 40 bytes.

Key IPv4 header fields include the following.

  • Source IP address (32 bits): The IP address of the sending device.
  • Destination IP address (32 bits): The IP address of the intended recipient.
  • TTL (Time to Live) (8 bits): Decremented by 1 at each router hop. When TTL reaches 0, the router discards the packet and sends an ICMP “Time Exceeded” message back to the source. Default TTL is 64 (Linux/macOS) or 128 (Windows).
  • Protocol (8 bits): Identifies the encapsulated upper-layer protocol — 6 for TCP, 17 for UDP, 1 for ICMP.
  • Identification / Fragment Offset / Flags: Control packet fragmentation when a packet exceeds the MTU of a link.

The maximum packet size on an Ethernet network is constrained by the MTU (Maximum Transmission Unit) of 1,500 bytes. A 20-byte IP header and 20-byte TCP header leave 1,460 bytes of payload per packet (the MSS — Maximum Segment Size). Packets larger than the link MTU are fragmented into smaller packets before transmission and reassembled at the destination.

IP Routing

IP routing is the process by which routers forward packets toward their destination based on the destination IP address in the packet header. Each router consults its routing table to determine the next hop — the next router in the path toward the destination.

Two routing protocols operate at different scales.

  • BGP (Border Gateway Protocol): Routes packets between Autonomous Systems (AS) — the large networks operated by ISPs, cloud providers, and enterprises. BGP is the routing protocol of the Internet. Each AS has a globally unique Autonomous System Number (ASN). BGP routers exchange reachability information about IP prefixes (CIDR blocks) they can deliver traffic to. BGP selects paths based on AS-path length, local preference, and policy, not purely on latency or bandwidth.
  • OSPF (Open Shortest Path First): An Interior Gateway Protocol (IGP) used within a single AS or enterprise network. OSPF calculates the shortest path (by cost metric, typically based on link bandwidth) using Dijkstra’s algorithm and converges within seconds of a topology change.

TCP vs UDP

TCP and UDP are the 2 primary transport-layer protocols. Both run on top of IP but offer different delivery guarantees suited to different application types.

TCP vs UDP - How Data Travels on the Internet: Packets, Routing, and Protocols Explained

TCP (Transmission Control Protocol) provides reliable, ordered, error-checked delivery. TCP uses a 3-way handshake to establish a connection (SYN → SYN-ACK → ACK) before data transfer begins. The receiver sends acknowledgment (ACK) packets confirming receipt of each segment.

Unacknowledged segments are retransmitted after a timeout. TCP adjusts transmission rate using congestion control (slow start, congestion avoidance, fast retransmit). TCP is used for HTTP/HTTPS, email (SMTP, IMAP), file transfers (FTP, SFTP), and any application where data integrity is required.

UDP (User Datagram Protocol) provides fast, connectionless transmission with no delivery guarantee. UDP sends datagrams without establishing a connection, without ACKs, and without retransmission. Lost packets are not recovered.

UDP is used for DNS queries (single request/response), video streaming (where a dropped frame is preferable to stalling), online gaming, and VoIP. UDP adds only an 8-byte header versus TCP’s 20-byte minimum, reducing overhead per packet.

TCP vs UDP Comparison Table

FeatureTCPUDP
Connection typeConnection-oriented (3-way handshake)Connectionless
ReliabilityGuaranteed delivery via ACK and retransmissionNo delivery guarantee — fire and forget
OrderingData delivered in order via sequence numbersNo ordering — packets may arrive out of sequence
Error checkingChecksum + retransmission on errorChecksum only — no retransmission
SpeedSlower due to overhead of ACK and handshakeFaster — minimal overhead
Header size20 bytes minimum8 bytes
Congestion controlYes (slow start, AIMD)No built-in congestion control
Typical use casesHTTP/HTTPS, email, FTP, SSHDNS, video streaming, VoIP, online gaming

The OSI Model: 7 Layers

The OSI (Open Systems Interconnection) model provides a conceptual framework that divides network communication into 7 layers, each with a specific function. Real-world TCP/IP networks collapse these into 4 layers (Application, Transport, Internet, Network Access), but the OSI model remains the standard reference for troubleshooting and protocol analysis.

  • Layer 7 — Application: End-user protocols — HTTP, HTTPS, FTP, SMTP, DNS. The layer applications interact with directly.
  • Layer 6 — Presentation: Data encoding, encryption, and compression. TLS encryption operates at this layer conceptually.
  • Layer 5 — Session: Manages sessions between applications — establishment, maintenance, and termination of communication sessions.
  • Layer 4 — Transport: TCP and UDP. Segmentation, sequencing, error recovery, and flow control.
  • Layer 3 — Network: IP addressing and routing. Routers operate at this layer, forwarding packets based on destination IP.
  • Layer 2 — Data Link: MAC addressing and frame delivery within a single network segment. Switches operate at this layer using MAC address tables.
  • Layer 1 — Physical: Actual transmission of bits — electrical signals on copper, light pulses on fiber, radio waves for Wi-Fi.

How a Web Request Travels from Browser to Server

A complete HTTPS web request follows this sequence with approximate latency contributions at each stage.

How a Web Request Travels from Browser to Server - How Data Travels on the Internet: Packets, Routing, and Protocols Exp
  1. DNS lookup (~20–120 ms uncached): Browser queries the recursive resolver for the domain’s IP address. Cached lookups complete in under 1 ms.
  2. TCP handshake (~RTT): Browser sends SYN to server; server replies SYN-ACK; browser replies ACK. One round-trip time (RTT). Trans-Atlantic RTT is typically 80–100 ms.
  3. TLS handshake (~1–2 RTT): Browser and server negotiate TLS version, cipher suite, and exchange certificates. TLS 1.3 reduces this to 1 RTT (or 0-RTT for resumptions).
  4. HTTP GET request: Browser sends the HTTP request (e.g., GET /index.html HTTP/2). The request header includes Host, User-Agent, Accept, and cookie fields.
  5. Server processing and TTFB: Server processes the request (database query, template rendering) and begins sending the response. Time to First Byte (TTFB) measures this delay — target is under 200 ms.
  6. CDN edge delivery: If the domain uses a CDN (Content Delivery Network) such as Cloudflare or Akamai, the request is served from the nearest edge node rather than the origin server, reducing RTT to 5–30 ms for most users.
  7. Response download: The server sends the response body in multiple TCP segments. The browser renders HTML incrementally and issues additional requests for linked CSS, JS, and image resources.

Key Takeaways

  • All Internet data travels as packets. Ethernet MTU limits packets to 1,500 bytes, leaving 1,460 bytes of TCP payload per packet.
  • BGP routes packets between Autonomous Systems globally. TTL prevents infinite routing loops — default TTL is 64 (Linux) or 128 (Windows).
  • TCP provides reliable ordered delivery via 3-way handshake, ACKs, and retransmission. UDP is connectionless with no delivery guarantee and only an 8-byte header.
  • The OSI model has 7 layers. Routers operate at Layer 3 (Network); switches operate at Layer 2 (Data Link); applications operate at Layer 7.
  • A web request involves DNS lookup, TCP handshake, TLS handshake, HTTP request, server processing, and response download — latency accumulates at each stage.
  • CDNs reduce TTFB by serving content from edge nodes within 5–30 ms RTT of most users worldwide.

What is a network packet?

A network packet is a small unit of data transmitted over a network. Each packet contains a header (source IP, destination IP, TTL, protocol) and a payload (actual data). Ethernet limits packet size to 1,500 bytes (MTU). Large data is split into multiple packets and reassembled at the destination.

What is the difference between TCP and UDP?

TCP is connection-oriented with guaranteed ordered delivery via ACKs and retransmission. UDP is connectionless with no delivery guarantee and 8-byte overhead. TCP is used for web and email; UDP is used for DNS, video streaming, and gaming where speed matters more than reliability.

What does TTL mean in networking?

TTL (Time to Live) is an 8-bit field in the IP header that decrements by 1 at each router hop. When TTL reaches 0, the router discards the packet and sends an ICMP error. TTL prevents packets from circulating indefinitely. Default TTL is 64 on Linux/macOS and 128 on Windows.

What is BGP in networking?

BGP (Border Gateway Protocol) is the routing protocol that exchanges reachability information between Autonomous Systems (AS) across the Internet. BGP selects paths based on AS-path length and policy. It is the only EGP (Exterior Gateway Protocol) used on the public Internet.

What are the 7 layers of the OSI model?

The 7 OSI layers are: Physical (1), Data Link (2), Network (3), Transport (4), Session (5), Presentation (6), and Application (7). Routers operate at Layer 3; switches at Layer 2; HTTP and DNS at Layer 7; TCP and UDP at Layer 4.

Last Thoughts on How Data Travels on the Internet

Every Internet interaction — loading a web page, sending an email, streaming video — begins with packet switching. Data is broken into 1,500-byte Ethernet packets, each routed independently by BGP across Autonomous Systems, reassembled at the destination by TCP. The OSI model maps each function to a specific layer, from physical signal transmission to application-level HTTP.

Latency accumulates across DNS resolution, TCP handshake, TLS negotiation, server processing, and network transit — CDNs and caching reduce this by moving content closer to users. Understanding this end-to-end path is foundational for network engineering, application performance optimization, and security analysis.

Nizam Ud Deen

Nizam Ud Deen is the founder of theCoreiTech, a tech-focused platform dedicated to simplifying the world of computers, hardware, and digital innovation. With nearly a decade of experience in digital marketing and IT, Nizam combines strategic marketing insight with deep technical understanding. As a passionate entrepreneur, he has built multiple successful digital products and online ventures, helping bridge the gap between technology and everyday users. His mission through theCoreiTech is to empower readers to make informed decisions about computers, hardware, and emerging tech trends through clear, data-driven, and actionable content.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button