Search code examples
node.jscentosvirtualboxremote-debugging

node.js on VirtualBox CentOS machine, no connection?


I've setup a CentOS 6.3 Box in a VirtualBox Machine, installed node.js and npm and wrote an example 'Hello World' Application which listens on port 8080 and IP '192.168.10.132' (this is the IP of the CentOS machine). The server starts correctly, but under 192.168.10.132:8080 on my host machine (Mac OS X 10.0.7) I always get an error.

Did I something wrong?


Solution

  • Generally I run into issues like this because I have not opened the port in iptables.

    The following command will add the port to iptables

    iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT -m comment --comment "node.js port"
    

    Then make sure to save your current config.

    service iptables save 
    

    then you'll need to restart iptables

    service iptables restart 
    

    For more info, check out the iptables docs here: http://wiki.centos.org/HowTos/Network/IPTables