We have two apps running (on top of linux) and both communicates through port 42605. I wanted to quickly verify if this is the only port that's been used for communication between them. I tried below rule, but it doesn't seems to work. So, just wanted to get this clarified, if I am doing it wrong.
Following is the sequence of commands i ran
iptables -I INPUT -j REJECT iptables -I INPUT -p tcp --dport 42605 -j ACCEPT iptables -I INPUT -p icmp -j ACCEPT iptables -I OUTPUT -p tcp --dport 42605 -j ACCEPT
So, this will get added in reverse order since I am inserting it.
I wanted to allow incoming and outgoing communications from and to 42605. Does the above rule looks good or am I doing it wrong?
Another question, would this be the right way to test, or maybe I should use "netstat" command to see which port has connection established with the other ip?