software-engineer-blog logoSoftware Engineer Blog

Module 5 · Networking

Unit 17 of 49

Unit 17 · Module 5 · Networking

What happens when you type a URL — DNS → TCP → TLS → HTTP

The most-asked interview question there is, answered end to end.

Unit 17 of the free 49-unit computer-science course, in networking. 2 topics to watch or read, 3 interview questions answered in full and a short self-check.

Watch or read

2 topics make up this unit. Take each one whichever way suits you, then answer the questions below.

VPN vs DNS

VPN and DNS both unblock content, but operate at different layers. VPN encrypts all traffic through a remote server; DNS only resolves names to IPs. Only VPN provides real privacy.

Read

CORS

CORS isn't browser gatekeeping—it stops an attack where cross-site requests auto-attach your login cookies. Learn the threat, the same-origin policy, and the one-line server fix.

ReelRead

Interview questions this unit unlocks

Asked out loud, answered out loud. Read the answer, then say it in your own words.

Walk me through what happens when you type a URL and press enter.

Four layers, in order. DNS turns the hostname into an IP — browser cache, OS cache, resolver, then the root, TLD and authoritative servers if nobody has it. TCP opens a connection with a three-way handshake, one round trip. TLS then negotiates a version and cipher, validates the certificate chain and derives session keys — one more round trip on 1.3, two on 1.2. Only then does the first HTTP request go out, and the response comes back to be parsed, with sub-resources fetched over the same connection.

The number that makes this answer land: before a single byte of your page moves you have already spent three or four round trips, which is why latency, not bandwidth, decides how fast a site feels.

What does a TLS certificate actually prove?

That the party you are talking to holds the private key for a name a certificate authority was willing to vouch for. That is all. It proves identity of the endpoint and gives you an encrypted channel; it says nothing about whether the site is honest, competent, or the one you meant to visit. The padlock means "nobody is reading this in the middle", not "this is safe".

The chain is what people forget: your browser trusts a small set of roots, and every certificate is valid only because it links back to one of them.

Why is DNS cached at so many levels, and what does that cost you?

Because a resolution is a network round trip to answer a question whose answer almost never changes, and the browser, the OS, the resolver and every intermediate all keep the record until its TTL expires. The cost lands the day you need to change it: a record with a 24-hour TTL is a 24-hour tail on any migration or failover, and you cannot recall the copies already handed out.

This is why you lower the TTL days before a cutover, not on the day.

Self-check — 3 questions

Answer alone, at 2am, with no interviewer in the room.

Part of Everything You Need to Know About Computer Science.