Thursday, 28 July 2016

How to enable a port in Linux

Go to /etc/sysconfig/ and open iptables-config file

add following entries :
iptables -A INPUT -p tcp --dport 3306 -j ACCEPT

iptables -A OUTPUT -p tcp --dport 3306 -j ACCEPT

save and close the file

Finally type the following command :

Verify whether port is enabled or not by using following command :

 netstat -lnt | awk '$6 == "LISTEN" && $4 ~ ".3306"'