0

I recently installed node on my VPS, and tried to complete a tutorial. I saved this code into server.js and hit node server.js in putty. I got instant "ban" from my VPS, I can't access it, however on other computers I can.

var net = require('net');
var server = net.createServer(function (socket) {
  console.log("Connection from " + socket.remoteAddress);
  socket.end("Hello World\n");
});
server.listen(7000, "localhost");
console.log("TCP server listening on port 7000 at localhost.");

Is this problem related to the servers firewall? What can I do to solve it?

Tamás
  • 9
  • 1

1 Answers1

0

Without more information on your platform, it's a little difficult to speculate. However if you can SSH in from another machine, check the iptables rules with iptables -L as root. You may see rules under a "fail2ban" chain or something like that, which relate to your machine's IP address. They will end in DROP or REJECT, and they'll be the rules you'll need to remove to regain access to your box.

To clear them out, first you need the line number for the rule you want to remove; pass iptables -L --line-numbers to see this. You'll see something like this:

Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         
1    REJECT  all  --  <some-ip>             anywhere  

Then you can do iptables --delete INPUT 1, which would delete the rule in my example.

Xyon
  • 151
  • 5