Where to start: symptom map
You don’t need to start at step 1 every time: the client error tells you which layers already succeeded.
| Client symptom | Where to start |
|---|---|
Network is unreachable or No route to host |
Steps 1–2: interface, ARP, and ip route get |
Could not resolve host or Temporary failure in name resolution |
Step 3: dig vs @1.1.1.1 and resolvectl status |
Instant Connection refused |
Step 4: sudo ss -tulnp on the server (0.0.0.0 vs 127.0.0.1) |
Connection timed out after 10–30 seconds |
Steps 5–6: nftables rules, route, and tcpdump (DROP vs REJECT) |
SSL certificate problem or 502 Bad Gateway |
Step 6: curl -svkI, openssl s_client, and the backend socket |
| Short commands work, large responses hang | Step 2: MTU probe with ping -M do -s … (MTU blackhole) |
Switch scenarios below to see how the same sequence of commands eliminates working layers and narrows the fault to a single point:
- L2/L3 · ip route✓ 10.0.0.1
- DNS · dig✕ SERVFAIL
- L4 · nc :443— works by IP
- L7 · curl— never reached
dig +noall +answer +comments example.org # ;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 19412 dig @1.1.1.1 +short example.org # 203.0.113.10
Name resolution succeeds through 1.1.1.1, while the local resolver returns SERVFAIL — the fault sits in system DNS, outside routing and the remote server.
resolvectl status and journalctl -u systemd-resolved -n 30
- L2/L3 · ip route✓ 10.0.0.1
- DNS · dig✓ 203.0.113.10
- L4 · nftables✕ DROP :443
- L7 · curl— timed out
nc -zv -w 3 203.0.113.10 443 # nc: connect to 203.0.113.10 port 443 (tcp) timed out: Operation now in progress sudo tcpdump -nn -i eth0 'host 198.51.100.20 and tcp port 443' # IP 198.51.100.20.51422 > 203.0.113.10.443: Flags [S], length 0 (no reply)
SYN packets reach the server’s NIC, then disappear in the firewall’s input or forward chain — neither SYN-ACK nor RST comes back.
sudo nft list ruleset (check drop rules and counters in input/forward)
- L2/L3 · ip route✓ reached host
- L4 · nftables✓ accept :8080
- Socket · ss✕ 127.0.0.1:8080
- Client✕ RST · refused
nc -zv -w 2 203.0.113.10 8080
# nc: connect to 203.0.113.10 port 8080 (tcp) failed: Connection refused
sudo ss -tulnp 'sport = :8080'
# tcp LISTEN 0 4096 127.0.0.1:8080 0.0.0.0:* users:(("docker-proxy",pid=1821,fd=7))The service is running, yet listens only on the 127.0.0.1 loopback interface. Nothing listens on the external IP, so the kernel immediately sends RST.
sudo ss -tulnp — look at Local Address:Port
- L2/L3 · route✓ 18 ms
- DNS · dig✓ 203.0.113.10
- L4 · TCP :443✓ SYN-ACK
- L7 · TLS✕ wrong cert
curl -svI https://example.org 2>&1 | grep -E 'Connected|subject:|SSL certificate' # * Connected to example.org (203.0.113.10) port 443 # * subject: CN=TRAEFIK DEFAULT CERT # * SSL certificate problem: unable to verify the first certificate
Network, DNS, and TCP are fine. The proxy on 443 matched no router for the sent SNI, or failed to renew its Let’s Encrypt certificate.
openssl s_client -connect 203.0.113.10:443 -servername example.org </dev/null
Step by step
Check interface, address, and neighbor (L2–L3)
Verify that the NIC is
UP, carries the expected IP and mask (IPv4, masks, and CIDR), and resolves the gateway over ARP (MAC, switch, ARP, and VLAN):ip -br link # lo UNKNOWN 00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP> # eth0 UP bc:24:11:af:27:2b <BROADCAST,MULTICAST,UP,LOWER_UP> ip -4 -br addr # lo UNKNOWN 127.0.0.1/8 # eth0 UP 10.0.0.11/24 ip neigh show dev eth0 # 10.0.0.1 lladdr e2:a1:e8:41:67:85 REACHABLENO-CARRIERorDOWNpoints to a physical cable, VLAN, or/etc/netplan/config issue.INCOMPLETEorFAILEDon the gateway means the server receives no ARP reply from the local segment.Check route, packet loss, and MTU (L3)
Ask the kernel which interface and source IP it picks to reach the target (Routing and LPM):
ip route get 1.1.1.1 # 1.1.1.1 via 10.0.0.1 dev eth0 src 10.0.0.11 uid 1000If a Docker bridge
br-…shows up here instead ofeth0, a container subnet overlaps the target’s address space (Docker subnet clashes with home network).Next, trace hop-by-hop loss, and if sessions stall mid-transfer, test the maximum unfragmented MTU:
mtr -n -r -c 10 1.1.1.1 # HOST: web1 Loss% Snt Last Avg Best Wrst StDev # 1.|-- 10.0.0.1 0.0% 10 0.2 0.2 0.2 0.3 0.0 # ... ping -M do -c 1 -W 1 -s 1472 203.0.113.101472payload bytes plus20bytes of IPv4 and8bytes of ICMP equal1500bytes. If1472fails while1464or1392replies, a PPPoE link or VPN tunnel on the path lowers the MTU (MTU blackhole).Separate DNS from network connectivity (L7 · DNS)
Compare the system resolver against an independent public server (DNS and dig):
dig +noall +answer +stats example.org A # example.org. 59 IN A 203.0.113.10 # ;; Query time: 4 msec # ;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP) dig @1.1.1.1 +short example.org A # 203.0.113.10If
@1.1.1.1returns an address while plaindigtimes out or returnsSERVFAIL, inspectsystemd-resolved:resolvectl statusCheck
AAAArecords too: when a domain publishes IPv6 and the server has broken IPv6 routing,curlandapttry IPv6 first and burn seconds before falling back to IPv4 (IPv6 in practice).Check the port and listening process (L4)
From the client, probe the specific TCP port directly instead of running
ping(ping is not a port check):nc -zv -w 3 203.0.113.10 443 # Connection to 203.0.113.10 443 port [tcp/https] succeeded!On the server, check which process owns the port, which address it binds to, and what state sockets are in (Ports and sockets, TCP: flags and states):
sudo ss -tulnp 'sport = :443 or sport = :8080' # Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process # tcp LISTEN 0 4096 127.0.0.1:8080 0.0.0.0:* users:(("docker-proxy",pid=1821,fd=7)) ss -s # Total: 220 # TCP: 40 (estab 5, closed 24, orphaned 0, timewait 7)Three facts jump out right away: whether the process is running, whether it bound to
127.0.0.1instead of0.0.0.0, and whether sockets are piling up inCLOSE-WAIT(an application leak) or fillingRecv-Q(the service cannot keep up with reading).Check the firewall and container network namespace
If the process listens on
0.0.0.0or the right interface IP and the client still times out, checknetfilterrules in both hooks —input(host services) andforward(containers published with-p, Linux network stack):sudo nft list rulesetWhen a
distrolessorscratchcontainer lacksssandip, enter its network namespace from the host viansenter:PID=$(docker inspect -f '{{.State.Pid}}' app) sudo nsenter -t "$PID" -n ss -tulnp sudo nsenter -t "$PID" -n ip routeThe command runs host binaries while inspecting the sockets, interfaces, and routes inside the container.
Check TLS, HTTP, and capture traffic when stuck
Measure the response, inspect the certificate, and time each phase (HTTP and TLS):
curl -sS -o /dev/null \ -w 'dns=%{time_namelookup}s tcp=%{time_connect}s tls=%{time_appconnect}s ttfb=%{time_starttransfer}s total=%{time_total}s code=%{http_code}\n' \ https://example.org # dns=0.004s tcp=0.022s tls=0.064s ttfb=0.118s total=0.121s code=200 openssl s_client -connect example.org:443 -servername example.org </dev/null 2>/dev/null \ | openssl x509 -noout -subject -issuer -dates # subject=CN = example.org # issuer=C = US, O = Let's Encrypt, CN = E6 # notBefore=Nov 1 00:00:00 2026 GMT # notAfter=Jan 30 00:00:00 2027 GMTIf the service sits behind a reverse proxy or CDN and you want to hit the origin directly without editing DNS, override the IP for one request with
--resolve(keeping the rightHostheader andSNI):curl --resolve example.org:443:203.0.113.10 -svI https://example.orgWhen logs stay silent and you need to know whether packets arrive at all, capture on the server with
tcpdumpand-nn(skipping reverse DNS and port-name lookups):sudo tcpdump -nn -i any 'host 198.51.100.20 and tcp port 443'If incoming
Flags [S]appears withoutFlags [S.]orFlags [R.]going back, the local firewall stopped the packet (AF_PACKETsits ahead ofnetfilter, Linux network stack).
How to read curl -w timings
Values printed by curl -w are cumulative from command start, so the duration of each stage is the
difference from the previous number:
tcp takes 18 ms and ttfb takes 3.5 seconds, the network is healthy: the backend or a database query is slow.If it doesn’t work
ping 1.1.1.1 replies, but curl https://example.org fails with Could not resolve host
- Cause
- L3 routing works, but the DNS resolver is failing (
systemd-resolvedis down, UDP/TCP53is blocked, or/etc/resolv.confpoints to the wrong server). - Fix
- Compare
dig example.orgagainstdig @1.1.1.1 example.org, then inspect the system resolver withresolvectl status.
nc -zv 203.0.113.10 443 hangs until timeout, while sudo tcpdump -nn on the server shows incoming Flags [S]
- Cause
tcpdumptaps incoming traffic viaAF_PACKETbeforenetfilterchains — the packet landed in the dump, then the firewall silently discarded it (DROP).- Fix
- Check rules and packet counters with
sudo nft list ruleset: look fordropin theinputhook (host services) andforwardhook (Docker containers, Docker ports bypass the input chain).
On the server itself curl http://127.0.0.1:8080 returns 200 OK, while another machine gets an instant Connection refused
- Cause
- The process is bound to
127.0.0.1:8080instead of0.0.0.0:8080(or the interface IP), or Docker published the port only on loopback. - Fix
- Check the
Local Address:Portcolumn insudo ss -tulnpand update the service bind address (0.0.0.0 vs 127.0.0.1).
mtr shows 50% packet loss on an intermediate router, while the final hop reports 0.0%
- Cause
- The intermediate router rate-limits ICMP
Time Exceededreplies from its CPU, while forwarding transit traffic without loss. - Fix
- Read loss at the final hop, and from the first hop where loss stays non-zero all the way to the destination (Routing and LPM).
The TCP handshake and a short GET /health succeed, but loading a full page or running ls -la over SSH hangs
- Cause
- An MTU blackhole: a VPN or PPPoE tunnel on the path has an MTU below 1500, and a firewall drops ICMP
Fragmentation Needed. - Fix
- Find the largest unfragmented payload with
ping -M do -c 1 -s 1472 <IP>and enable MSS clamping on the router (MTU blackhole).
How to check
Run a quick self-check on the server: an open local port, a known closed port, DNS resolution, and HTTPS timings.
nc -zv -w 2 127.0.0.1 22
# Connection to 127.0.0.1 22 port [tcp/ssh] succeeded!
nc -zv -w 2 127.0.0.1 9999
# nc: connect to 127.0.0.1 port 9999 (tcp) failed: Connection refused
dig +short example.org A
curl -sS -o /dev/null -w 'dns=%{time_namelookup}s tcp=%{time_connect}s tls=%{time_appconnect}s ttfb=%{time_starttransfer}s code=%{http_code}\n' https://example.org
The open port returns succeeded!, the closed one returns an immediate Connection refused, and curl -w
prints non-zero timings for each phase with code=200.