RedHat Linux under iptables firewall settings

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.