`curl http://10.0.1.20:8080` returns `curl: (7) Failed to connect to 10.0.1.20 port 8080: Connection refused`.
BeginnerTroubleshootingNetworking, DNS and firewalls
Answer
Likely causes → The host is reachable but nothing listens on that port/IP (service down, bound to 127.0.0.1 only), or a firewall rule actively rejects with a TCP RST/ICMP.
Diagnose →
# on the server
sudo ss -tlnp | grep 8080 # listening? on 0.0.0.0 or 127.0.0.1?
systemctl status myapp
sudo nft list ruleset | grep -i reject
Fix → Start the service, or change its bind address to 0.0.0.0/the right interface; remove the reject rule if it's wrong.
Prevent → Health checks that test from outside the host, not just localhost.
More on Networking, DNS and firewalls
The same request instead hangs and ends with `curl: (28) Failed to connect to 10.0.1.20 port 8080 after 130000 ms: Connection timed out`. How is this different from "refused"?Beginner`ping google.com` fails with `ping: google.com: Temporary failure in name resolution`, but `ping 8.8.8.8` works.Beginner`dig api.internal` works, but the application and `curl` fail with `Could not resolve host: api.internal`.Intermediate`/etc/resolv.conf` changes you made disappear after a reboot or a few minutes.BeginnerDNS lookups take exactly 5 seconds before succeeding.IntermediateShort names like `db01` don't resolve, but `db01.corp.example.com` does.Beginner