Notes
1 The name
Start with the name. getent hosts shows what the application really resolves, including etc hosts. dig shows what DNS says, and dig at the authoritative server shows what was published. Read the status: NXDOMAIN, a missing record; SERVFAIL, a broken resolver; REFUSED, you asked a server that will not answer, as our lab server did. If the address is old, it is caching and TTLs. Write down the IP you got.
$ getent hosts api.internal what the app sees $ dig api.internal +short $ dig @authoritative ... NXDOMAIN → missing record SERVFAIL → resolver broken REFUSED → wrong server (our lab: no upstream) old IP → TTL, caching
2 The route
Next, the route. ip route get shows which gateway and interface the kernel will use. Network is unreachable, as in our namespace lab, means this host has no route at all. traceroute shows each hop, and mtr runs it continuously with loss per hop, which is how you find where packets die. Loss that starts at one hop and continues to the end is real; loss at a single middle hop is often just a router ignoring traceroute. And check the return path.
$ ip route get 10.0.2.20 via 10.0.1.1 dev va "Network is unreachable" → no route on this host $ traceroute -n 10.0.2.20 1 10.0.1.1 2 10.0.2.20 $ mtr -n host live loss per hop remember the return route
3 The port
Third, the port. On the server, ss minus t l n p shows whether the process is listening, and on which address. ShopRung listened on zero dot zero dot zero dot zero, every interface; a service on one two seven dot zero dot zero dot one can only be reached locally. From the client, netcat minus z v tests the TCP connection. An instant refusal means nothing listens or a reject rule; a hang means packets disappear, which is the next step.
on the server: $ ss -tlnp | grep 8080 0.0.0.0:8080 node 127.0.0.1:8080 → local only from the client: $ nc -zv host 8080 refused in ms → no listener or a reject rule timeout → step 4
4 The firewall
Fourth, firewalls. Our drop rule turned a request into a three second timeout, while its counter grew by three SYN packets; a reject rule failed in a tenth of a millisecond. So list the rules with counters and watch which counter grows while you retry. In the cloud, check the security groups on both ends, the network ACLs and route tables, and VPC flow logs, which record rejected connections.
drop rule: 3.002 s timeout counter: 3 packets (SYNs) reject rule: 0.12 ms refused $ nft list ruleset $ iptables -L -n -v (watch counters grow) cloud: SG on both ends, NACL, route tables, VPC flow logs (REJECT)
5 TLS
Fifth, TLS. If TCP connects but HTTPS fails, use openssl s client with the server name. Verify return code zero means the chain is fine. curl's exit sixty covers the two failures we caused: an issuer the client does not trust, and a name not in the certificate. Check the dates for expiry. And remember a strict client, like Python three point thirteen in our lab, may reject what curl accepts.
$ openssl s_client -connect
host:443 -servername host
Verify return code: 0 (ok)
$ curl -v https://host
exit 60: unknown issuer or
name mismatch (we saw both)
expired? openssl x509
-noout -dates
strict clients differ 6 The application
Finally the application. curl minus w splits the request into DNS, connect, TLS and time to first byte, so you know which layer is slow. Read status codes as directions: five oh two means the proxy could not reach the app, and nginx's error log said exactly that, connect failed, connection refused, with the upstream address. Five oh four means the app was too slow. Four two nine and four thirteen are proxy limits, not app bugs.
$ curl -w "dns %{time_
namelookup} connect ...
tls %{time_appconnect}
ttfb %{time_starttransfer}"
502 → proxy could not reach
upstream (error.log says
connect() failed 111)
504 → upstream too slow
429/413 → proxy limits Proof: tcpdump
When teams disagree, capture packets. tcpdump on the client or server, filtered by host and port, shows the truth. A SYN going out with nothing coming back means the packets are dropped on the way. A reset coming back means refused. A full handshake and a request, but no response, puts the problem in the application or proxy. Save a capture with minus w and open it in Wireshark. This ends most network arguments.
$ tcpdump -ni eth0 host
10.0.2.20 and port 8080
SYN out, nothing back →
dropped on the way
SYN out, RST back →
refused
SYN, SYN-ACK, ACK, data, no
reply → app or proxy
-w file.pcap for Wireshark Write it up
Then write it up, with evidence rather than opinions. The symptom and when it started. What each check showed, for example SYNs leaving A but never reaching B, on captures from both sides. The cause, such as a security group change. The fix and how you verified it. And prevention: put security groups in Terraform with review, and add a synthetic check that tests this path every minute.
- symptom: A → B timed out since 14:02
- evidence: SYNs leave A, none reach B (tcpdump both)
- cause: SG change removed A's group from B's rule
- fix + verification
- prevention: SG in Terraform + review, synthetic check
Common mistakes
Mistakes. Starting with the application code before checking name, route and port. Testing from your laptop instead of from the machine that actually fails. Relying on ping. Changing several settings at once, so you never learn which one mattered. Trusting dig when the app reads etc hosts. And arguing from opinions instead of a packet capture.
- starting at the app code
- testing from the wrong machine (your laptop)
- ping only
- changing several things at once
- trusting dig over getent
- no capture, only opinions
Say it like this
In the interview: from service A's machine, I check that B's name resolves to the right address, that there is a route, and whether a TCP connection is refused or times out. A timeout sends me to firewalls and security groups on both sides, with counters or flow logs. If TCP connects, I test TLS with openssl, then the request with curl minus w and the proxy logs. If teams disagree, tcpdump on both ends decides.
- "From A: does B's name resolve
- correctly? Is there a route? Does
- nc connect: refused or timeout?
- Timeout → firewalls and SGs on both sides, counters or flow
- logs. Connected → TLS with openssl, then curl -w and the proxy logs. tcpdump to prove."