INHow the Internet Works · Lesson 7 of 7
Internet Cheatsheet
Layers, ports, status codes, and debug commands — one page.
Text
── The layers ───────────────────────────
Application HTTP, DNS, SSH (meaning)
Transport TCP/UDP (delivery, ports)
Internet IP (addressing, routing)
Link Ethernet, WiFi (next physical hop)
data = envelopes in envelopes; routers read IP only
── Addresses ────────────────────────────
IPv4: 93.184.216.34 (4 bytes, scarce)
IPv6: 2606:2800:... (16 bytes, plentiful)
private: 10.x | 172.16-31.x | 192.168.x
127.0.0.1 = localhost | NAT: home shares one public IP
── DNS ──────────────────────────────────
browser cache -> OS -> resolver -> root -> TLD -> authoritative
A=IPv4 AAAA=IPv6 CNAME=alias MX=mail TXT=misc NS=who answers
TTL controls caching -> why changes "propagate"
── TCP vs UDP ───────────────────────────
TCP: handshake (SYN/SYN-ACK/ACK), numbered bytes,
ACKs, retransmit, ordering -> reliable stream
UDP: fling packets, no promises -> DNS, games, calls
QUIC (HTTP/3): reliability over UDP, no head-of-line block
connection = (src IP, src port, dst IP, dst port)
── Ports worth knowing ──────────────────
22 SSH | 53 DNS | 80 HTTP | 443 HTTPS
5432 Postgres | 3306 MySQL | 6379 Redis | 3000/8080 dev
── HTTP ─────────────────────────────────
GET read | POST create | PUT replace | PATCH edit | DELETE
2xx ok | 3xx redirect | 4xx your fault | 5xx server's fault
200 ok 201 created 301 moved 304 cached 400 bad request
401 unauthenticated 403 forbidden 404 missing
429 rate limited 500 crashed 502/503 backend down
cookies = server-set state the browser echoes back
HTTPS = HTTP in TLS: certs prove identity, math encryptsBash
# ── Debugging toolbox ───────────────────
ping example.com # reachable? latency?
traceroute example.com # the route (tracert on Win)
dig example.com +short # DNS answer
dig example.com MX # any record type
dig example.com +trace # full resolution chain
curl -v https://example.com # whole HTTP conversation
curl -I https://example.com # headers only
curl -o /dev/null -s -w '%{time_total}s\n' URL # timing
curl ifconfig.me # my public IP
netstat -an | grep LISTEN # what's listening here
nc -zv host 443 # is that port open?
# ── Reading a failure ───────────────────
# DNS error (NXDOMAIN) -> name wrong / DNS broken
# connection refused -> host up, nothing on port
# timeout -> firewall or host down
# TLS/cert error -> expired/wrong-domain cert
# 4xx -> fix your request
# 5xx -> their server; retry later
# works here, not there -> caching or DNS, always
# ── Page-load order (perf checklist) ────
# DNS -> TCP -> TLS -> request -> HTML -> subresources
# fewer round trips > smaller bytes
# CDN = closer server; cache-control = skip requests
# defer scripts; browser DevTools Network tab = truth