#Opening a Port on Linux#
-
Check if the port is being used or not (testing port 3000 in this example)
$ netstat -na | grep 3000
-
If the port is in use, then most likely it will be the software firewall blocking you. You can check by running
$ sudo /sbin/iptables -L
-
Check for the port. If it isn’t listed, you will need to add it
$ sudo vi /etc/sysconfig/iptables
-
Copy one of the other lines that is allowing a connection to (
–dport
) a port, and edit to allow access to your new port. -
Save the file
-
Restart iptables
$ sudo /sbin/service iptables restart