"The application does not answer." Before opening a network ticket, two questions are often enough to decide. On the server: is something really listening on that port, and on which address? On the client: is the connection refused, rejected or lost? Each answer points to a different team.
The commands below were run on Ubuntu 26.04. For the firewall cases, I created an isolated network namespace with test iptables rules, without touching the machine's own firewall. Replace 8080 with your port.
On the server: who listens, and where
sudo ss -ltnp sudo ss -ltnp 'sport = :8080'
-l listening sockets, -t TCP, -n numbers instead of names, -p the process. Add -u for UDP. Without sudo, the process column stays empty for other users' services. Here is the output with a small test web server on port 8099:
State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
LISTEN 0 5 127.0.0.1:8099 0.0.0.0:* users:(("python3",pid=1333923,fd=3))
The column that matters most is Local Address:
| Listening address | Reachable from |
|---|---|
| 127.0.0.1 or [::1] | the machine itself only |
| 0.0.0.0 | every IPv4 address of the machine |
| [::] or * | every address, IPv6 and often IPv4 |
| one specific address | that interface only |
A service listening on 127.0.0.1 answers a curl run on the server perfectly, and nobody else. It is the most common cause of "it works for me". The fix is in the service configuration (listen, bind, bind-address depending on the software), not in the firewall.
If ss shows nothing on that port, nothing is listening: the service is stopped, has crashed, or listens on another port. Go back to systemctl status.
Two other ways to find who owns a port:
sudo lsof -nP -iTCP:8080 -sTCP:LISTEN sudo fuser -v -n tcp 8080
On the client: refused, rejected or lost
telnet is no longer installed by default on most servers. nc replaces it, and bash can open a TCP connection on its own:
nc -zv -w 3 server.example.org 8080 timeout 3 bash -c '</dev/tcp/server.example.org/8080' && echo open
-z tests without sending data, -w 3 gives up after 3 seconds. The /dev/tcp form is specific to bash and works even on a minimal server without nc.
The error message is the useful part. Here is what I got for four ports, depending on the rule applied:
nc: connect to 127.0.0.1 port 8000 (tcp) failed: Connection refused
nc: connect to 127.0.0.1 port 8001 (tcp) failed: No route to host
nc: connect to 127.0.0.1 port 8002 (tcp) failed: Connection refused
nc: connect to 127.0.0.1 port 8003 (tcp) timed out: Operation now in progress
How to read it:
- Connection refused (port 8000, no rule): the machine was reached and answered that no program listens on that port. The network is fine: look at the service. A firewall set to
REJECT --reject-with tcp-resetproduces the same message (port 8002):sson the server tells the two apart. - No route to host (port 8001,
REJECT --reject-with icmp-host-prohibited): a firewall rejected the connection and said so. This message also appears when there really is no route, but if other ports on the same machine answer, it is the firewall. - timed out (port 8003,
DROP): nobody answered. The packet was silently dropped by a firewall, or never arrives (wrong route, machine off, cloud security group). I got the same error towards192.0.2.1, an address reserved for documentation and therefore unreachable.
For a web service: time each step
curl -sS -o /dev/null -w 'dns=%{time_namelookup} connect=%{time_connect} total=%{time_total} code=%{http_code}\n' http://server.example.org:8080/The output separates DNS resolution, opening the connection and the full response. If dns takes 5 seconds, the application is not the slow part. If connect is fast and total very long, the network is fine and the application keeps you waiting. curl -v also shows the detailed exchange.
Check the path and the name
ip -br addr ip route get 192.0.2.10 getent hosts server.example.org dig +short server.example.org
ip route get tells which interface and gateway a packet to that address will use, and with which source address. It is the direct answer to "am I going out through the right network?".
getent hosts resolves the name the way applications do: it reads /etc/hosts then DNS, according to /etc/nsswitch.conf. dig queries DNS only. If the two give different addresses, a line in /etc/hosts overrides DNS, and that is often the key to the puzzle.
The full sequence
On the server:
sudo ss -ltnp 'sport = :8080'
On the client:
getent hosts server.example.org ip route get 192.0.2.10 nc -zv -w 3 server.example.org 8080
Nothing listening: it is the service. Listening on 127.0.0.1: it is its configuration. Refused: the network gets through, the service does not answer on that port. Rejected or timed out: it is the path, and only then is a network ticket justified, with these outputs attached.