Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

All incoming connections seem to be refused on my Fedora machine, except on port 80 with apache.

The ports I have tried are 8111 and 1111, neither does work. I have done the forwarding on my hardware router and configured the firewall (iptables, using the GUI) to allow connections on those ports. However, it is still not working.

When I run a small HTTP server (the node.js hello-world) on one of these ports and try to curl it, it only works on localhost but not with the public ip address.

Using the public address, I immediately get curl: (7) couldn't connect to host.

Without the port forwarding or the firewall exception, this takes a while and does not appear immediately - so i think that that's not the problem. I also tried using the web browser instead of curl, without any difference.

I have tried a tool named tcptrack, which shows this whenever I try to curl using the public address (I changed the public address here, 192.168.0.2 is the local one):

215.17.123.60:52014   192.168.0.2:1111      RESET        16s    0 B/s
192.168.0.2:52014     215.17.123.60:1111    RESET        16s    0 B/s

So I am receiving the packages but they are rejected somehow (I don't know exactly what RESET means). Is there another firewall or something? Like I said, port 80 works fine.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

How are you running this webserver? It seems like it's only listening to localhost, and not to your actual ip address. So it will only accept connections comming from localhost (127.0.0.1).

Try binding it to 192.168.0.2 (or 0.0.0.0) instead of localhost.

So if you're starting it like this:

http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, '127.0.0.1');

change 127.0.0.1 to 192.168.0.2

share|improve this answer
    
thank you!! how could i forget this? :D –  wst Sep 5 '12 at 16:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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