Open a port on Ubuntu 14.04
66,381
Solution 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.
Solution 2
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
Related videos on Youtube
Author by
Vitone
Updated on September 18, 2022Comments
-
Vitone over 1 year
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.
-
2707974 almost 9 yearsIf you don't see
port 9000
with commandnetstat
inlistening
you app not running or maybe is better to say, your server do not expect connection on that port. -
Vitone almost 9 yearsAnd what should I do if my server don't expect connection on that port?
-
2707974 almost 9 yearsStart app. Do you have any log from app start?
-
Vitone almost 9 years@2707974, yes, you're right. I tried use another VPS and everything was working well even without opening of additional ports.
-
-
dariush over 7 yearsThe
To make the change permanent
didn't work for me, but this one did.