Elastix iptables Security Settings

Source: Internet
Author: User
Tags iptables elastix

#!/bin/sh

#脚本名称: firewall.sh

#用途: Firewall settings, only Web and SSH ports developed

/sbin/modprobe Ip_tables

/sbin/modprobe Iptable_filter

/sbin/modprobe Iptable_nat

/sbin/modprobe Ip_conntrack

/sbin/modprobe ip_conntrack_ftp

#以上命令为载入模块

Iptables-p INPUT DROP

Iptables-f INPUT

Iptables-p OUTPUT ACCEPT

Iptables-f OUTPUT

Iptables-p FORWARD DROP

Iptables-f FORWARD

Iptables-t nat-f

#以上命令为设置默认规则----prohibit all, attention will empty the original rule, please note the original rule of the save backup.

############################### #add tointernet##########################

#iptables-A input-p UDP--sport 53-j ACCEPT

#iptables-A input-p UDP--sport 123-j ACCEPT

#iptables-A input-p TCP--sport 20-j ACCEPT

#iptables-A input-p TCP--sport 21-j ACCEPT

#iptables-A input-p TCP--sport 80-j ACCEPT

#iptables-A input-p udp-m UDP--dport 5060-j ACCEPT

#iptables-A input-p udp-m UDP--dport 4569-j ACCEPT

#iptables-A input-p udp-m UDP--dport 10000:20000-j ACCEPT

############################### #add tointernet##########################

#以上规则的意思是, open your server access to the return trip allows, if your server does not require external access, please delete

#

#

############################### #add manager#############################

Iptables-a input-s 127.0.0.1-j ACCEPT

Iptables-a input-s 192.168.1.0/24-j ACCEPT

#iptables-A input-s {your source IP}-P 0-j ACCEPT

############################### #add manager#############################

#以上的规则的意思是, open all communications for your management client (including 22 ports, of course), but except for this source IP, any other IP access to the server's 22 ports

#

#

############################### #add 80##################################

Iptables-a input-p TCP--dport 80-j ACCEPT

Iptables-a input-p TCP--dport 22-j ACCEPT

############################### #add 80##################################

#开放外网所有访问你的web and SSH

#如果你的MYSQL或其它服务需要对外开放, add it in the format above

#

#

################################ #close icmp#################################

Iptables-a input-p icmp-j DROP

################################ #close icmp#################################

#以上规则的意思是关闭icmp

#

/etc/rc.d/init.d/iptables Save

/etc/rc.d/init.d/iptables restart

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.