0

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!

4
  • 3
    Are you sure there's anything listening on those ports? – Celada Dec 22 '16 at 20:48
  • at least for two of them I'm pretty sure that logstash should be listening. All works fine when I use port 8080 but when I change to something else it breaks – Fawix Dec 22 '16 at 20:54
  • What about ss -tnlp? (On my system, -v gives the version and ignores any other options). – user4556274 Dec 22 '16 at 21:17
  • I still get no output with ss -tnlp | grep :5544 when I do ss -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! – Fawix Dec 22 '16 at 21:25
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.