1

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!

asked Dec 22, 2016 at 20:46
4
  • 3
    Are you sure there's anything listening on those ports? Commented Dec 22, 2016 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 Commented Dec 22, 2016 at 20:54
  • What about ss -tnlp? (On my system, -v gives the version and ignores any other options). Commented Dec 22, 2016 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! Commented Dec 22, 2016 at 21:25

1 Answer 1

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.

answered Dec 23, 2016 at 15:44

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.