I'm currently trying to diagnose why my build of Libreoffice online keeps giving '504 Timed Out' errors on my nginx reverse proxy. I shutdown the entire daemon, hoping to see an error along the lines of 'Connection Refused' but I still get Connection timed out.
So I fired up netcat (nc) and ran the following:
nc 192.168.1.13 9980 -v
And it gives me the following response:
nc: connect to 192.168.1.13 port 9980 (tcp) failed: connection timed out
So I figured that the daemon was still alive somewhere hidden on my system, so I rebooted it an verified that nothing was on port 9980 with netstat.
When I run this command from the server itself:
nc localhost 9980 -v
It says connection refused! Even though localhost and 192.168.1.13 point to the same machine!
Also:
Results of ip addr are
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether d0:67:e5:23:50:56 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.13/24 brd 192.168.1.255 scope global dynamic noprefixroute enp3s0
valid_lft 2719sec preferred_lft 2719sec
inet6 fe80::ca8b:d4b8:34aa:7036/64 scope link noprefixroute
valid_lft forever preferred_lft forever
I figured it may have been a firewall error, so I temporarily flushed every iptables rule and added one back.
iptables -A INPUT -p tcp --dport 9980 -j REJECT
Again, nc on 192.168.1.13 times out and nc on localhost gives me connection refused.
Essentially, my issue is this:
nc 192.168.1.13 9980 ---> Connection timed out
nc localhost 9980 ---> Connection refused
Why are there different answers if they are both the same machine?
Any ideas on what could be going on with the network? I'd really like to avoid changing ips since a few services on another computer depend on that ip remaining static.
Duplicate edit: I read the question that was referred to when this was marked as a duplicate, and here's why I believe my question is different:
I'm not asking why Connection refused is appearing. I want that to appear. I want to know why the connection is timing out, even when the host is reachable on literally every other port. And I mentioned in the question above that I checked the firewall settings and flushed everything to get rid of variables, which still causes it to timeout. In the other question, the answer simply says "A port isn't open" (I'm aware) and "A firewall is blocking it" (I took diagnostic steps so it wasn't)