Linux Networking Tools
debt(d7/e3/b3/t5)
Closest to 'only careful code review or runtime testing' (d7). The detection_hints note 'network connectivity issues without diagnostic information' — the misuse (using wrong/deprecated tools or missing flags) is not caught by any compiler or standard linter. The tools listed (curl, netstat, ss, tcpdump, nmap, dig) are the diagnostic tools themselves, not static analysis tools that catch their misuse. A developer would only discover the problem during live debugging or code review.
Closest to 'simple parameterised fix' (e3). The quick_fix describes replacing netstat with ss -tlnp, adding -n flags, and switching to curl -v — these are simple command-line substitutions. While each fix is nearly one-line, common_mistakes list several distinct patterns (netstat vs ss, missing -n, curl redirects, tcpdump without -n), so it's slightly more than a single swap but still within one operational context, landing at e3.
Closest to 'localised tax' (b3). The applies_to scope is web and cli PHP contexts, and the tags indicate a devops/debugging concern. Misuse of these tools (e.g. using netstat on a busy server) is painful in the moment but doesn't propagate into application code or architectural decisions. It's a localised operational tax on the debugging workflow rather than a systemic burden on the codebase.
Closest to 'notable trap' (t5). The misconception field explicitly states: 'ping proves a server is accessible — ping tests ICMP; a server can be running and serving HTTP while blocking ICMP.' This is a well-documented, commonly encountered gotcha that many developers learn the hard way, matching the t5 anchor. Additionally, netstat vs ss deprecation and missing -n flags are further documented gotchas in common_mistakes.
Also Known As
TL;DR
Explanation
Key tools: ss (socket statistics — replaces netstat, faster), netstat -tlnp (listening ports and processes), curl -v (HTTP request tracing), dig (DNS lookup), ping / traceroute (connectivity and routing), tcpdump -i eth0 port 80 (packet capture), nc (netcat — port testing), nmap (port scanning), ip addr / ip route (network interfaces and routing tables). For PHP debugging: check if PHP-FPM is listening (ss -tlnp | grep php), test database connectivity (nc -zv db-host 3306), trace DNS resolution (dig +trace example.com).
Common Misconception
Why It Matters
Common Mistakes
- Using netstat instead of ss — netstat is deprecated and orders of magnitude slower on busy servers.
- Not using -n flag — without it, tools do reverse DNS lookups adding seconds to output.
- Forgetting that curl follows redirects — use -L to follow, or remove it to debug redirect chains.
- tcpdump without -n — triggers DNS lookups for every packet, making output unusable.
Code Examples
# Debugging connection refused — guessing:
# 'The DB connection is failing somehow'
# Restart services without diagnosis
# Check application logs (empty — connection never made)
# Guess firewall, guess DNS, guess config
# Hours of trial and error
# Systematic diagnosis:
# 1. Is PHP-FPM listening?
ss -tlnp | grep php
# 2. Can app server reach DB port?
nc -zv db.internal 3306
# 3. DNS resolving correctly?
dig +short db.internal
# 4. Trace HTTP request:
curl -v https://api.example.com/health
# 5. Watch packets:
tcpdump -i eth0 -n port 3306 -c 20
# Each tool answers a specific question