Site icon New Generation Enterprise Linux

Stop guessing if a remote port is actually open

Networking & Firewall (Ss/Netstat/Iptables/Nftables/Curl)

Stop guessing if a remote port is actually open

đź§© The Challenge

You’ve got a new app backend sitting on a VM, and your frontend container can’t talk to it. Logs just say “connection refused” or “timeout.” You ssh into the backend, `ss -tlnp` shows the service is listening, firewall rules look okay. So what gives? Is it the network path? Another firewall layer? The service configuration? And the sheer amount of head-scratching over this has wasted more coffee than I care to admit.

đź’ˇ The Fix

Instead of just blindly `ping`ing or `telnet`ing (if you even have `telnet` installed anymore), use `curl` for a quick, definitive check to see if you can even *hit* that port from the client side. It’ll give you clear feedback, fast, without needing to install anything extra on modern systems.

curl --max-time 5 --connect-timeout 3 -v telnet://your_backend_ip:12345

⚙️ Why It Works

This command tells `curl` to try and establish a raw TCP connection using its `telnet` protocol handler to that specific IP and port. The `-v` flag shows you the entire connection handshake, from DNS resolution to the SYN/ACK, or where exactly it fails. The timeouts stop it from hanging indefinitely if the port isn’t open or responding.

🚀 Pro-Tip: For truly stubborn connections, watch `tcpdump -ni any port 12345` on both ends simultaneously. You’ll see exactly where the packets stop flowing.

Linux Tips & Tricks | © ngelinux.com | 11/27/2026

0 0 votes
Article Rating
Exit mobile version