Simple Firewall Initialization

Source: Internet
Author: User
Tags ssh port

#! /Bin/bash # Clear the firewall iptables-Fiptables-X # disable the INPUT and FPRWARD chains, allow OUTPUT chain iptables-p input DROPiptables-p output ACCEPTiptables-p forward accept # enable 22 ssh port iptables-a input-p tcp -- dport 22-j ACCEPT # enable 80 web port iptables -a input-p tcp -- dport 80-j ACCEPT # enable 3306 mysql port iptables-a input-p tcp -- dport 3306-j ACCEPT # enable 9000 php-fpm port iptables- INPUT-p tcp -- dport 9000-j ACCEPT # enable port 111 and port 25 iptables-a input-p tcp -- dport 110-j ACCEPTiptables-a input-p tcp -- dport 25- j ACCEPT # enable the 11211 memcached port iptables-a input-p tcp -- dport 11211-j ACCEPT # enable the 161 and 162 SNMP ports iptables-a input-p tcp -- dport 161-j ACCEPTiptables -a input-p tcp -- dport 162-j ACCEPT # enable the 873 rsync port iptables-a input-p tcp -- dport 873-j ACCEPT # enable the ping port iptables-a input-p icmp-j ACCEPT # Allow the ESTABLISHED link iptables-a input-m state -- state ESTABLISHED, RELATED-j ACCEPT # Allow the return port iptables-a input-I lo-j ACCEPTiptables-A OUTPUT-o lo-j ACCEPT

 

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.