2

I'm trying to set up a simple server to be accessible from the Internet. To do so, I have opened port 8080 by executing the following command:

$ sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent

When I try to connect to my server by executing:

$ telnet my-external-ip 8080

I get:

telnet: connect to address my-external-ip: Connection refused

I have no problem when I connect to my server using local address, i.e. I can connect to http://localhost:8080/

I'm behind router but I set correct forwarding. I use CentOS Linux 7.

When I run

$ ss -tnlp |grep 8080

I get

LISTEN     0      128  :::8080 :::* users:(("java",pid=6836,fd=309))

UPDATE As user Paul H. suggested in the comments, the reason behind why I couldn't connect is that my router doesn't allow for NAT loopback. My configuration of Linux was OK.

closed as off-topic by roaima, Kiwy, Jeff Schaller, Timothy Martin, jimmij Mar 21 '18 at 19:12

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – roaima, Kiwy, Jeff Schaller, Timothy Martin, jimmij
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Is the listening socket bound to 127.0.0.1:8080 or to 0.0.0.0:8080? If the former, it can not accept connections from outside. – Hans-Martin Mosner Mar 21 '18 at 12:04
  • 1
    I can connect to either to 127.0.0.1:8080 or to 0.0.0.0:8080 if this is what you meant. – menteith Mar 21 '18 at 12:08
  • No, please run "netstat -ln | grep 8080" to see the address on which your process listens. – Hans-Martin Mosner Mar 21 '18 at 12:12
  • 1
    I get tcp6 0 0 :::8080 :::* LISTEN. – menteith Mar 21 '18 at 12:16
  • do you get the "connection refused" immediately? if blocked by firewall, this would more probably lead to a timeout error I think... So I would look more closely to logs and configuration around telent server. – tonioc Mar 21 '18 at 12:16
1

Your server seems to be listening on IPv6 address "tcp6 0 0 :::8080 :::* LISTEN", not IPv4. So make sure you are connecting to proper address.

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