In general, Iptables is already included in the Linux distribution.
Run
#iptables--versionTo see if the system is installing iptables boot iptables: #service iptables Start view iptables rule set#iptables--list Below is what iptables look like when planning is not defined: Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (Policy accept) target prot opt source destination Chain OUTPUT (policy accept) Target P Rot opt source DestinationView firewall Status: #/etc/init.d/iptables StatusIf you get a series of information, the firewall is turned on. MySQL default port 3306,linux Firewall is blocked by default. See if Port 3306 is open: #lsof-i:3306If there is an indication that the display is open. If no indication is not open "Linux commune http://www.linuxidc.com" to access 3306 can be done in two ways, one is to shut down the firewall and the other is to have the firewall open 3306 ports. First, open 3306 port: Method One: #iptables-i input-i eth0-p tcp--dport 3306-j ACCEPT # iptables-i output-o eth0-p tcp--sport 3306-j acce PT The command that corresponds to block port 3306 is: #iptables-i input-i eth0-p tcp--dport 3306-j DROP # iptables-i output-o eth0-p tcp--sport 3306-j dropThen save #/etc/rc.d/init.d/iptables SaveMethod Two: 1, modify the/etc/sysconfig/iptables file, add the following line:-a rh-firewall-1-input-m State--state new-m tcp-p TCP--dport 3306-j Accept Restart firewall after: #Service iptables RestartSecond, the firewall is closed: two ways: 1) After the restart to take effect: #chkconfig iptables off (the corresponding open firewall command is: # chkconfig iptables on ) 2) immediate effect, but after reboot the firewall will start again: #Service iptables Stop (the corresponding open firewall command is: # service iptables start ) Finish
RedHat Linux under iptables firewall settings