How to add / remove port in Linux machine ?

After logging into the machine please type the below commands as follow

  • iptables -L - This shows the list of ports currently opened 



  • iptables -A INPUT -p tcp --dport 3306 -j ACCEPT

                               3306 – MySQl Port

                  This command enables the MySQL port


  • iptables -D INPUT -p tcp --dport 3306 -j DROP

                                 This command disable the MySQL port



          You can use TELNET to check the connectivity after giving both the commands




Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request