CentOS firewall configuration method-detailed explanation of how to configure CentOS Firewall

Source: Internet
Author: User
There are a lot of questions about how to set the CentOS firewall. below is how to set the CentOS firewall. I saw several pages CentOS firewall content are wrong, the following is the correct method: # sbiniptables-IINPUT-ptcp -- dport80-jACCEPT # sbiniptable

There are a lot of questions about how to set the CentOS firewall. below is how to set the CentOS firewall.

After reading several pages, there are errors in CentOS firewall content. The following is the correct method:


  1. #/Sbin/iptables-I INPUT-p tCp-- Dport 80-j ACCEPT

  2. #/Sbin/iptables-I INPUT-p tcp -- dport 22-j ACCEPT

Then save: #/etc/rc. d/init. d/iptables save and restart the computer. By default, ports 80 and 22 are enabled for the firewall.

The CentOS firewall settings have been completed.

In this case, you may not restart the computer: #/etc/init. d/iptables restart the firewall to close the firewall and view the firewall information: #/etc/init. d/iptablesStatUs disable the Firewall Service: #/etc/init. d/iptables stop permanently disabled?

I don't know how to use the permanent method :#Chkconfig-Level 35 iptables off and check whether there is already one:

  1. [Root @ vcentos ~] #/Etc/init. d/iptables status


  2. Table: filter
  3. Chain INPUT (policy ACCEPT)
  4. Num target prot opt source destination
  5. 1 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt: 80
  6. 2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt: 80
  7. 3 RH-FireWall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0
  8. Chain FORWARD (policy ACCEPT)
  9. Num target prot opt source destination
  10. 1 RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0

You can set up the CentOS firewall in the future.

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.