How a Packet Travels Across the Internet: End to End
Follow a packet's complete journey from clicking a link to loading a webpage, covering DNS resolution, ARP, switching, routing, NAT, and TCP connections. This ties together fundamental networking concepts into one coherent story.
Ever wondered what actually happens when you click a link in your browser? Let's trace a single packet's incredible journey across the internet, from your laptop to a web server and back again. This story brings together all the networking concepts you've learned into one coherent picture.
The Setup
You're sitting at your laptop, connected to your home Wi-Fi, and you click a link to visit blog.anythingoverip.com. Your laptop's IP address is 192.168.1.100, and your router's IP is 192.168.1.1. The web server lives somewhere out on the internet at IP address 203.0.113.50.
Step 1: DNS Resolution
Your browser doesn't know what blog.anythingoverip.com means in terms of IP addresses. First, it needs to resolve this domain name.
Your laptop sends a DNS query to your configured DNS server (let's say 8.8.8.8). This query travels through your local network, out to the internet, and comes back with the answer: 203.0.113.50.
Now your browser knows where to send the HTTP request.
Step 2: ARP for the Default Gateway
Your laptop knows it needs to send a packet to 203.0.113.50, but that's not on your local network. It needs to send the packet to your default gateway (192.168.1.1).
But here's the thing: your laptop needs the MAC address of the router to actually send the frame. It broadcasts an ARP request:
ARP Request: Who has 192.168.1.1? Tell 192.168.1.100Your router responds with its MAC address, and your laptop caches this information in its ARP table.
Step 3: The TCP Three-Way Handshake Begins
Your browser wants to establish a TCP connection to the web server on port 80 (HTTP). It creates a TCP SYN packet:
- Source IP: 192.168.1.100
- Destination IP: 203.0.113.50
- Source Port: Random high port (e.g., 54321)
- Destination Port: 80
Step 4: Layer 2 Switching
Your laptop encapsulates this IP packet in an Ethernet frame with:
- Destination MAC: Your router's MAC address
- Source MAC: Your laptop's MAC address
This frame travels over Wi-Fi to your home router.
Step 5: Routing and NAT
Your home router receives the frame, strips off the Ethernet header, and looks at the IP packet. It sees the destination 203.0.113.50 and consults its routing table. Since this isn't a local address, it forwards the packet toward its default gateway (your ISP).
But first, it performs NAT (Network Address Translation). It changes the source IP from 192.168.1.100 to your public IP address (let's say 98.76.54.32) and tracks this translation in its NAT table.
Step 6: Internet Routing
Now the packet begins its journey across the internet. Each router it encounters:
- Receives the packet
- Looks up the destination in its routing table
- Forwards the packet to the next hop
- Decrements the TTL (Time To Live)
The packet might hop through 10-15 routers, following the best path determined by routing protocols like OSPF or BGP.
Step 7: Reaching the Destination
Eventually, the packet reaches the network where 203.0.113.50 lives. The final router performs ARP to find the web server's MAC address, encapsulates the packet in a new Ethernet frame, and delivers it.
The web server receives the TCP SYN packet and responds with a SYN-ACK, which follows the reverse path back to you.
Step 8: Completing the Connection
When the SYN-ACK reaches your router, NAT translates the destination back to 192.168.1.100 and forwards it to your laptop. Your laptop sends the final ACK, completing the three-way handshake.
Now your browser sends an HTTP GET request, the server processes it and sends back the HTML content, and your browser renders the web page.
The Return Journey
Every response packet follows the same process in reverse: the server sends to your public IP, routers forward based on their tables, your home router performs reverse NAT, and finally your laptop receives the data.
What's Next
This journey shows how Layer 2 switching, Layer 3 routing, NAT, and application protocols all work together. In our next post, we'll dive deeper into how routing protocols like OSPF actually build those routing tables that made this packet delivery possible.