The strictest iptables rules for centos

Source: Internet
Author: User

I remember when I was in college, the teacher said

Because iptables rules are post-written, the preceding rules are overwritten.

In Linux, the safest firewall rule is to discard all port packets and then enable the required ports one by one.

Now I work, but I still do it in strict accordance with the methods taught by the teacher, but I often encounter many problems and have a long struggle;

The following is an iptables rule that I configured based on the actual needs of my server by constantly querying materials. Thank you very much for your help!

# Generatea by iptabes-save v1.4.7 on Sat Nov 23 10:18:45 2013*filter:INPUT DROP [198:17785]:FORWARD DROP [0:0]:OUTPUT DROP [6:456]-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT-A INPUT -m state --state NEW -m tcp -p tcp --dport 3360 -j ACCEPT-A OUTPUT -p tcp -m tcp --sport 22 -j ACCEPT-A OUTPUT -m state --state NEW -m tcp -p tcp --sport 3360 -j ACCEPT-A OUTPUT -p tcp --dport 53 -j ACCEPT-A OUTPUT -p udp --dport 53 -j ACCEPT-A INPUT -m state --state ESTABLISHED -j ACCEPT-A OUTPUT -m state --state ESTABLISHED -j ACCEPT-A OUTPUT -p tcp --dport 80 -j ACCEPT-A INPUT -p tcp --dport 80 -j ACCEPT-A OUTPUT -p tcp --dport 443 -j ACCEPT-A INPUT -p tcp --sport 443 -j ACCEPT-A INPUT -p tcp --dport 21 -j ACCEPT-A INPUT -p tcp --dport 20 -j ACCEPT-A OUTPUT -p tcp --sport 21 -j ACCEPT-A OUTPUT -p tcp --sport 20 -j ACCEPT-A INPUT -p tcp --dport 2092 -j ACCEPT-A OUTPUT -p tcp --sport 2092 -j ACCEPT-A OUTPUT -p tcp --sport 2100 -j ACCEPT-A INPUT -p tcp --dport 2100 -j ACCEPT-A OUTPUT -p tcp --sport 2029 -j ACCEPT-A INPUT -p tcp --dport 2029 -j ACCEPT-A OUTPUT -p tcp --sport 2104 -j ACCEPT-A INPUT -p tcp --dport 2104 -j ACCEPT-A OUTPUT -p tcp --sport 2101 -j ACCEPT-A INPUT -p tcp --dport 2101 -j ACCEPT-A INPUT -p tcp --dport 3306 -j ACCEPT-A INPUT -p udp --dport 3306 -j ACCEPT-A OUTPUT -p tcp --sport 3306 -j ACCEPT-A OUTPUT -p udp --sport 3306 -j ACCEPT-A OUTPUT -p tcp --dport 11211 -j ACCEPT-A INPUT -m state --state NEW,RELATED,ESTABLISHED -j ACCEPTCOMMIT


The strictest iptables rules for centos

Related Article

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.