2

I have seen similar threads, but they didn't help me.

I am using Ubuntu 14.04.2 LTS (GNU/Linux 2.6.32-042stab108.5 x86_64) on my VPS.

I ran a node.js application on port 9000, but this port is closed, so I can't see my web page using a web browser via the Internet.

My opened ports:

sudo netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      752/apache2
tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      366/vsftpd
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      454/sshd
tcp        0      0 0.0.0.0:25              0.0.0.0:*               LISTEN      611/master
tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN      485/mongod
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      599/mysqld
tcp6       0      0 :::22                   :::*                    LISTEN      454/sshd
tcp6       0      0 :::25                   :::*                    LISTEN      611/master

I was trying to execute the following commands:

sudo iptables -I INPUT -p tcp -m tcp --dport 9000 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 9000 -j ACCEPT

But it didn't help me. Moreover, the /etc/iptables.rules file is missing, so I couldn't save changes using the following command: iptables-save > /etc/iptables.rules

Could you help me please? Thanks.

  • 1
    If you don't see port 9000 with command netstat in listening you app not running or maybe is better to say, your server do not expect connection on that port. – 2707974 Jul 16 '15 at 6:54
  • And what should I do if my server don't expect connection on that port? – Vitone Jul 16 '15 at 6:56
  • Start app. Do you have any log from app start? – 2707974 Jul 16 '15 at 7:35
  • @2707974, yes, you're right. I tried use another VPS and everything was working well even without opening of additional ports. – Vitone Jul 16 '15 at 9:04
0

If you don't see port 9000 with command netstat in listening you app not running or maybe is better to say, your server do not expect connection on that port.

5

Give this a try

sudo iptables -I INPUT -p tcp -s 0.0.0.0/0 --dport 9000 -j ACCEPT

To make the change permanent

iptables-save > /etc/iptables.conf # Save this changes to file
touch /etc/network/if-up.d/iptables # Create file to call conf from
echo "iptables-restore < /etc/iptables.conf" >> /etc/network/if-up.d/iptables # Add this line to this file
chmod +x /etc/network/if-up.d/iptables  # Make the script executable

Original Source

  • The To make the change permanent didn't work for me, but this one did. – dariush Nov 4 '16 at 14:09

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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