Computer networks

TCP handshake and teardown, TLS, DNS resolution, HTTP semantics. "What happens when you type a URL" — own every hop of that answer.

About 33 min read3-question knowledge check

The mental model

The network is a postal system with layers of envelopes. When you send a letter, you do not think about roads, sorting depots, or airplanes — you write an address and drop it in a box. Underneath, your letter gets wrapped in progressively larger envelopes: a local sorting label, a regional routing label, a national one. Each depot reads only its label, does its one job, and passes the packet on. The genius is that the person writing the letter and the airplane carrying it never need to understand each other.

That is the layered model, and it is the single most useful mental tool in networking. Your application speaks HTTP and thinks in requests and responses. HTTP hands its bytes to TCP, which thinks in reliable ordered streams and does not care that they spell HTTP. TCP hands segments to IP, which thinks in "get this packet one hop closer to that address" and does not care whether delivery is reliable. IP hands packets to the link layer, which thinks in "put these electrical or radio signals on this specific wire". Each layer adds its own envelope (a header) on the way down and strips it on the way up. When something breaks, the layer model tells you where to look — a DNS failure, a TCP reset, a TLS handshake error, and an HTTP 500 are four completely different depots.

Why this exists in interviews. "What happens when you type a URL and press enter" is the most famous systems interview question precisely because a good answer traverses every layer with mechanism: DNS resolution, TCP's three-way handshake, TLS negotiation, HTTP semantics, and the return path — each a place where latency hides and each a place where things fail. The candidate who can own every hop of that answer demonstrates that they understand the machine underneath their framework, and the one who says "the browser gets the page" reveals they have only ever seen the top envelope.

The full lesson continues with 15 more sections
  • Deep dive
  • Internal architecture
  • Real-world use cases
  • Best practices
  • Common mistakes
  • Performance
  • Security
  • Production troubleshooting
  • Advantages & disadvantages
  • Alternatives
  • Interview expectations
  • Interview questions
  • Facts to remember
  • Cheat sheet
  • Quick revision