Skip to main content

Networking cheatsheet

A one-page reference for networking fundamentals. For the OSI/TCP-IP models, subnetting, and TLS handshake detail, see the complete guide.

๐Ÿ“– Full guide: Networking โ†’

Troubleshooting toolsโ€‹

ping -c 4 example.com
traceroute example.com
mtr example.com # continuous traceroute+ping
curl -v https://example.com # full request/response + TLS
dig example.com # DNS resolution
tcpdump -i eth0 port 443
ss -tulpn # listening/established sockets
nc -zv example.com 443 # port reachability

Diagnostic order under pressureโ€‹

  1. ping โ€” is the path up? (ICMP is often blocked, so a failed ping โ‰  down)
  2. dig/nslookup โ€” does the name resolve to the expected IP?
  3. nc -zv / curl โ€” is the port/service accepting connections?
  4. traceroute/mtr โ€” where is latency/loss happening?
  5. tcpdump โ€” inspect actual bytes on the wire.

TCP vs UDPโ€‹

TCPUDP
Connection3-way handshakeconnectionless
Reliabilityguaranteed, orderedbest-effort
Use caseHTTP, DB connsDNS queries, video, gaming

DNS resolution flowโ€‹

Browser cache โ†’ OS cache โ†’ resolver (recursive) โ†’
root โ†’ TLD โ†’ authoritative nameserver โ†’ answer

L4 vs L7 load balancingโ€‹

  • L4 โ€” routes on IP/port, fast, protocol-agnostic.
  • L7 โ€” routes on HTTP content (headers, path, host) โ€” enables path-based routing, TLS termination, content-aware rules.

CIDR quick referenceโ€‹

/32 = 1 host        /24 = 256 addrs (typical subnet)
/16 = 65,536 addrs /8 = 16.7M addrs

Firewalls & NATโ€‹

NAT translates private IPs to a public one at the network edge; firewalls filter by IP/port/protocol (and L7 rules for app firewalls). A "connection refused" often means firewall/security-group, not a dead service.

See: Common Failure Scenarios an SRE Debugs