map / networking / layers
Networking · principle 1 of 6
Packets & layers
Each layer wraps the one above it, so every problem lives at a specific layer — find the layer, and you’ve halved the search.
01 · Why it’s true
Each layer only talks to the layer directly above and below it. HTTP doesn’t know about routing, and IP doesn’t know about HTTP. On the way out, every layer adds its own header around the data from the layer above (encapsulation); on the way in, each layer strips its header and hands the rest up.
Because responsibilities are split cleanly, symptoms point to layers: a name that won’t resolve (DNS), a refused connection (TCP), a certificate error (TLS), and a 503 (HTTP) are different problems with different owners. Working out which layer is failing is usually the fastest way to cut the search space in half.
02 · Picture it
03 · In the interview
- Structuring a debugging answer: start at one end of the stack and move one layer at a time, saying what you’ve ruled out.
- Knowing which tool sees which layer:
dig(DNS),pingandtraceroute(IP),ssandtcpdump(TCP),openssl s_client(TLS),curl -v(HTTP).
04 · Practice question
“A service can’t reach its database. Walk me through how you’d narrow it down.”
A strong answer covers
- Name resolution: does the hostname resolve to the address you expect (
dig)? - Reachability: is there a route, and is anything in between dropping traffic (firewalls, security groups)?
- Transport: does a TCP connection to the port succeed, get refused (nothing listening), or time out (filtered or dead host)?
- Above TCP: TLS errors, authentication failures, or the database refusing connections (for example, a connection limit).
- Say which layer you’ve confirmed at each step so the interviewer can follow the elimination.