Interview Prep/Networking/Connectivity: refused, timed out, no route

`connect: Cannot assign requested address` when the app opens outbound connections.

IntermediateTroubleshootingConnectivity: refused, timed out, no route
Answer

Likely causes → Ephemeral port exhaustion toward one destination IP:port (EADDRNOTAVAIL), or the app tries to bind to a source IP not on the host.

Diagnose →

sysctl net.ipv4.ip_local_port_range
ss -tan state time-wait | wc -l
ss -tan dst 10.0.5.9:443 | wc -l

Fix → Reuse connections (HTTP keep-alive, pooling), widen ip_local_port_range (e.g. 1024 65000), enable net.ipv4.tcp_tw_reuse=1 for outbound, or spread traffic across more destination IPs.

Prevent → Track outbound connection rate and TIME_WAIT counts; insist on pooling in client libraries.

All Networking questions Roadmap: Networking for DevOps

More on Connectivity: refused, timed out, no route