Centos7 disable firewall to install iptables and configure

Source: Internet
Author: User
: This article mainly introduces how to disable and configure iptables for firewall in centos7. For more information about PHP tutorials, see. I recently played nginx as an image server. after installing it on Sentos, I found that the virtual machine could not be accessed and port 80 was not enabled.

Find a good article http://linux.it.net.cn/CentOS/fast/2015/0110/11567.html

1. configure the firewall. enable port 80 and Port 3306, and use firewall as the firewall by default. here, change it to iptables firewall. 1. disable firewall: systemctl stop firewalld. service # Stop firewallsystemctl disable firewalld. service # Disable firewall from starting Linux at startup, http: // linux.it.net. cn2. install iptables firewall yum install iptables-services # install Linux, http: // linux.it.net. cnvi/etc/sysconfig/iptables # Edit the firewall configuration file IT network, http://www.it.net.cn# Firewall configuration written by system-config-firewall # Manual customization of this file is not recommended. * filter: input accept [0: 0] Linux learning, http: // linux.it.net.cn: forward accept [0: 0] Linux learning, http: // linux.it.net.cn: output accept [0: 0] Linux learning, http: // linux.it.net.cn-a input-m state -- state ESTABLISHED, RELATED-j ACCEPT Linux learning, http: // linux.it.net.cn-a input-p icmp-j ACCEPT-A INPUT-I lo -J ACCEPT-A INPUT-m state -- state NEW-m tcp-p tcp -- dport 22-j ACCEPT-A INPUT-m state -- state NEW-m tcp-p tcp -- dport 80-j ACCEPT Linux learning, http: // linux.it.net.cn-a input-m state -- state NEW-m tcp-p tcp -- dport 3306-j ACCEPT-A INPUT-j REJECT -- reject-with icmp-host-prohibited Linux learning, http: // linux.it.net.cn-a forward-j REJECT -- reject-with icmp-host-prohibitedCOMMIT: wq! # Save and exit systemctl restart iptables. service # Restart the firewall to make the configuration take effect. systemctl enable iptables. service # set the firewall to start up 2. disable SELINUX Linux, http: // linux.it.net. cnvi/etc/selinux/config Linux learning, http: // linux.it.net.cn # SELINUX = enforcing # Comment out # SELINUXTYPE = targeted # Comment out SELINUX = disabled # Add IT network, http://www.it.net.cn:wq ! # Save and exit setenforce 0 # Make the configuration take effect immediately

The above introduces centos7 to disable firewall to install iptables and configure it, including some content. if you are interested in the PHP Tutorial, you will be helpful.

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.