How to Open Ports Through the Firewall
Originally written for Ubuntu 12.04, not much has changed. Here are the quick and easy steps to open any port. For this guide, we will focus on 3306, but you can change that number for any other port number.
In most cases following simple rule opens TCP port 3306:
iptables -A INPUT -i eth0 -p tcp -m tcp – -dport 3306 -j ACCEPT
Port is now open and you are done!