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โ
pingโ is the path up? (ICMP is often blocked, so a failed ping โ down)dig/nslookupโ does the name resolve to the expected IP?nc -zv/curlโ is the port/service accepting connections?traceroute/mtrโ where is latency/loss happening?tcpdumpโ inspect actual bytes on the wire.
TCP vs UDPโ
| TCP | UDP | |
|---|---|---|
| Connection | 3-way handshake | connectionless |
| Reliability | guaranteed, ordered | best-effort |
| Use case | HTTP, DB conns | DNS 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