3
I have my mac mini running a nodejs server on port 8000. On the mac, I can hit it at 127.0.0.1:8000/something. I get back a "hello world" type of response.
On the same network, from a different machine, I cannot hit this server on the mac. I am getting time outs. I have been pulling my hair out trying to understand why.
I check the machine on the local net. For instance 192.168.1.7:8000 should resolve to that machine and port from another machine. Times out.
I have a NAS admin page sitting at 192.168.1.200:5000 (sorry about that typo before) and it resolves beautifully. Port 5000 is forwarded to the NAS from the router.
I have set up the firewall rules (on the router) in exactly the same way for nodejs as I did for the NAS. The NAS is available outside of my network via a router rule and a no-ip dynamic DNS mapping. The nodejs server is forwarded the same way. No dice, times out.
Any thoughts? I have no firewall (that I can detect) on the mac. I can see the server listening to 8000 on the mac. It works locally.
What am I doing wrong here?
UPDATES with answers to questions.
Thank you all for the feedback, Here are the answers to your questions.
Output from netstat.
netstat -anp tcp | grep 8000
tcp4 0 0 *.8000 *.* LISTEN
I do not have the mac firewall running (at least in the system settings I mean). I have seen posts about something called IPFW, but I have no idea what that is.
On the mac, when I hit 192.168.1.7:8000 I get:
Hello World
My understanding of nodejs is that I just "bind it" to a port. Here is the code, right out of their example.
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(8000);
console.log('Server running at http://127.0.0.1:8000/');
2I think 198.162.1.200 is a typo. If so, please fix. Also, please edit your question to include the output of
netstat -anp tcp | grep 8000
on the host that's running nodejs, which will show the state of listening and active TCP connections on port 8000. – Kyle Jones – 2012-03-12T18:17:52.293Factor out the router and the network. Try to access the service from the Mac locally using the exact same URL as you try to use with other machines on the LAN. It's possible the service is just bound to
127.0.0.1
and not the LAN IP. – David Schwartz – 2012-03-12T20:05:04.580Did you open the port on OS X's built-in firewall as well? Also when you started the server, did you set it to listen to 0.0.0.0 as opposed to 127.0.0.1? – billc.cn – 2012-03-12T20:31:50.090