I have a ruby webapp running on the port 5555 on FreeBsd 11. For some reason it's not visible from the Internet at all, although ipfw isn't running.

$ curl -i
curl: (7) Failed to connect to port 5555: Connection refused

But the app is visible from that server, from localhost:

curl -i
[....returns data]

curl -i
[....returns data]

What can be the reason?


$ sockstat
user123  ruby       93839 7  tcp6   ::1:5555              *:*
user123  ruby       93839 8  tcp4        *:*
  • can you add the output of netstat -tlpn|grep 5555?
    – allo
    Oct 10 '17 at 13:28
  • Does your server have a public ip assigned on the network interface or it has a private ip? please provide the output of the command provided by allo Oct 10 '17 at 13:31
  • @allo netstat: illegal option -- t
    – Joichi
    Oct 10 '17 at 13:32
  • @BogdanStoica yes
    – Joichi
    Oct 10 '17 at 13:41
  • do you have any firewall running on the server?! Oct 10 '17 at 13:42

I'm not entirely sure whether this applies here, but some ruby webservers like e.g. webrick (the default webserver for Rails) do not bind to your external IP by default. So this might not even be a problem with your firewall, but just a missing configuration. Given the output of sockstat, this might be the case here. For webrick, you should pass -b x.x.x.x to the command to bind the server to your external IP address.

  • where did I say Rails?
    – Joichi
    Oct 10 '17 at 14:03
  • That was an example. Your application is not binding to your external IP, that's your problem. Since you did not write which webapp you are using you have to find out yourself on how to configure it properly.
    – duenni
    Oct 10 '17 at 14:07
  • @duenni and you don't need to know what app it is.
    – Joichi
    Oct 11 '17 at 3:17
  • You didn't say Rails. I took webrick as an example as that is a very common webserver in ruby development environments (since it's the Rails default). I'm assuming that you're approaching this machine from another system and that the IP is publicly available. But since you give as little information as you're currently doing, we're all guessing here. Oct 16 '17 at 15:34

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.