A pedagogically correct mental model
Imagine you type https://music.amazon.com in the browser (like Chrome or Brave) and press Enter.
Step 1: The Application Layer (The Browser's Initial Work)
Your browser is the primary actor here and you are at the Application Layer of the overall internet networking. I don’t like OSI model as it is outdated AF. This is how things really move, you can call it the TCP/ IP model.
This is a high level overview, you can go to unimaginable amount of detail in every step, for example - how IP routes packets or how TCP or UDP works.
A. The Browser first checks locally
- The browser needs music.amazon.com’s IP address to communicate.
- Before sending anything over the network, your browser checks its local memory for any shortcuts:
- Service Worker Cache: If this is a modern Progressive Web App (PWA), a background script called a Service Worker can intercept the request. It can decide to serve a cached version (like reading a cached news article on a plane) or let the request go to the network.
- DNS Cache: The browser checks its memory, and then the operating system's memory, to see if it recently looked up the IP address for
music.amazon.com.
- HTTP Cache: It checks for saved responses like images, CSS, or HTML from previous visits.
- HSTS (HTTP Strict Transport Security): The browser first checks a special list to see if Amazon has been marked as HTTPS-only. If so, it immediately "upgrades" the connection, forcing it to use encryption (TLS) on port 443, refusing any plaintext HTTP.
B. Find IP: DNS Resolution Kick-Off
- If no cached IP is found, the browser must find the IP address for
music.amazon.com.using a DNS Lookup:
- The browser asks the Operating System (OS) resolver for the IP.
- The OS sends a DNS query to the configured DNS Resolver (e.g., your ISP, or a public one like 8.8.8.8).
- The DNS resolver may return: (if you dont know these things, just know you finally get an IP for music.amazon.com)
- an A record (IPv4 address),
- an AAAA record (IPv6 address), or
- a CNAME chain that points to another domain before resolving to an IP.
- The OS receives the final IP and gives it back to the browser.
Step 2: The Link / Access Layer (The Local Connection)
Now that your laptop knows the IP address of music.amazon.com, the request needs to physically leave your device and get onto your local network and then to internet. This involves the Link/Access Layer
A. Local Addressing
- Your device needs the physical address of the next step**: your home router**. It uses the Address Resolution Protocol (ARP).
- Your laptop broadcasts: "Who has the IP address of my router (your default gateway)? Tell me your MAC address.
- The router replies with its MAC address. Your laptop caches this mapping.
B. Encapsulation for the Local Network
- Your browser's request is a complex message, but for local transmission, it’s wrapped in layers: