I am working on a simple Node.js app. This requires a particular port to be open. For example if I want the app to listen to port (say) 5122, I will have to first open the port 5122. For this I have applied the following rule in my iptables
iptables -I INPUT 3 --proto tcp --dport 5122 -j ACCEPT
service iptables save
Initially this worked for me. But suddenly after some it stopped working. I now, wanted to check whether the port 5122 is really open or not. I issued the command
nmap -sT -O localhost
I don’t see any such ports listed here. But
sudo iptables -L shows it like this -
ACCEPT tcp -- anywhere anywhere tcp dpt:5122
ACCEPT tcp -- anywhere anywhere tcp dpt:5122
I see this line 2 times. Still confused! No idea.
I now opened the following url http://www.yougetsignal.com/tools/open-ports/ and entered my host IP and Port and it says, Port 5122 is closed on 50.56.246.162 (which is my host IP)
My question is how do I permanently keep a particular port open for listening.
Any help would be highly appreciated.