On CentOS 7 I am trying to open connections to some services in my localhost using both HTTP and direct TCP/UDP (web server, db, etc) but I keep getting connection refused on ports that are not 8080 or 80 ... (ps: ssh to port 22 works fine btw).
Here is what I tried so far:
I checked selinux status..:
[root@ ~]# sestatus
SELinux status: disabled
Then I checked for firewalls
[root@ ~]# systemctl status firewalld
●くろまる firewalld.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
[root@ ~]# systemctl status iptables
●くろまる iptables.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
So if it's not selinux nor firewalls, what should I look for?
Here is what netcat output is (notice that works fine on 8080 and 80)
Note: the ^C
is just to indicate the interrupt signal because nc
has connected
[root@ ~]# nc localhost 8080
^C
[root@ ~]# nc localhost 80
^C
[root@ ~]# nc -v localhost 5544
Ncat: Version 6.40 ( http://nmap.org/ncat )
Ncat: Connection to ::1 failed: Connection refused.
Ncat: Trying next address...
Ncat: Connection refused.
[root@ ~]# nc -v 127.0.0.1 25544
Ncat: Version 6.40 ( http://nmap.org/ncat )
Ncat: Connection refused.
ss -vtnlp | grep :5544
don't give me anything either (and my service on the other side keeps getting connection refused).
Thanks for any help!
1 Answer 1
It turns out that the service that was supposed to listen for the connections were not listening! After moving the service to a much higher port it's now working, however I don't know why that would be the case.. (the below is truncated)
[root ~]# ss -tnlp | grep :35544
LISTEN 0 50 :::35544
Maybe this helps others:
the major indicator (which I totally missed) was that the ss -tnlp
command was not listing the port that I was expecting to be listend to.
Also when doing ss -tnlp | grep :port
the result was empty and that actually meant the port wasn't "open for connections" thus the connection refused error message.
In my case the process was logstash which didn't throw out a single error about not being able to listen to the port.
ss -tnlp
? (On my system,-v
gives the version and ignores any other options).ss -tnlp | grep :5544
when I doss -plnt
I see that the ports I'm reaching are not being listened in, looks like logstash is not listening on the configured ports for whatever reason!