Network Debugging Tools (ss, tcpdump, curl)
On this page
DNS → TCP → TLS → HTTP: Debug in Order
- Don't jump to application logs before proving lower layers.
- Collect packet-level evidence only when needed (tcpdump).
Layer 1: DNS
getent hosts example.com time getent hosts example.com
Layer 2: TCP
# is the port reachable? nc -vz -w 2 example.com 443 2>/dev/null || true # check local sockets ss -lntp | head ss -ant state syn-sent,syn-recv,established | head
Layer 3: TLS
openssl s_client -connect example.com:443 -servername example.com </dev/null | grep -E 'Verify return code|subject=|issuer=|notAfter'
Layer 4: HTTP
curl -sv https://example.com/health --max-time 5 || true curl -sv -H 'x-request-id: dbg-002' https://example.com/api --max-time 10 || true
tcpdump: Minimal, Targeted
# capture only what you need, short window sudo tcpdump -ni any host <IP> and port 443 -c 200
Failure Modes
- SYN retransmits: firewall drop or route blackhole.
- TLS alerts: SNI/chain/cipher mismatch.
- HTTP 502/504: upstream timeout or unhealthy backend.