- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
iptables 常用配置实例 2006-11-01
#外网 eth0 ──ip 为自动获取 #内网 eth1 ──ip /16
#!/bin/sh #
modprobe ipt_MASQUERADE modprobe ip_conntrack_ftp modprobe ip_nat_ftp
iptables -F iptables -t nat -F iptables -X iptables -t nat -X
#INPUT
iptables -P INPUT DROP
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# 允许内网 samba( 可以和 windows 文件共享通信的一个 linux 协, 不需要的不要打开),smtp,pop3,需要 imap 等协议的,请自行添加相应端口
iptables -A INPUT -p tcp -m multiport --dports 110,80,25,445,1863,5222 -j ACCEPT iptables -A INPUT -p tcp -s /16 --dport 139 -j ACCEPT
#允许 dns 解析通过,如果内网配置了 DNS 服务器(转发器),那只允许转发器那个 IP 能过,请自行修改,(-s ip)
iptables -A INPUT -i eth1 -p udp -m multiport --dports 53 -j ACCEPT
#允许外网 vpn 连接(企业用户有 VPN 的话,需要打开) #iptables -A INPUT -p tcp --dport 1723 -j ACCEPT #iptables -A INPUT -p gre -j ACCEPT
iptables -A INPUT -s /16 -p tcp -m state --state ESTABLISHED,RELATED -j ACCEPT #只允许最多 20 个初始连接,超过的丢弃
iptables -A INPUT -i eth0 -p tcp --syn -m connlimit --connlimit-above 20 -j DROP
#允许最多 20 个初始连接,超过的丢弃
iptables -A INPUT -s 172.16.0/16 -p tcp --syn -m connlimit --connlimit-above 20 -j DROP
#禁止 icmp 通信-ping 建议测试时不要打开
#iptables -A INPUT -p icmp -m limit --limit 3/s -j LOG --log-level INFO --log-prefix ICMP packet IN:
#iptables -A INPUT -p icmp -j DROP
#内网转发
iptables -t nat -A POSTROUTING -o eth0 -s /24 -j MASQUERADE
#防止 SYN 攻击 轻量
iptables -N syn-flood
iptables -A INPUT -p tcp --syn -j syn-flood
iptables -I syn-flood -p tcp -m limit --limit 3/s --limit-burst 6 -j RETURN iptables -A syn-flood -j REJECT
#FORWARD
iptables -P FORWARD DROP
iptables -A FORWARD -p tcp -s /16 -m multiport --dports 80,110,21,25,1723 -j ACCEPT
iptables -A FORWARD -p udp -s 172.16.0/16 --dport 53 -j ACCEPT
#允许 vpn 客户走 vpn 网络连接外网(网吧一般不需要开,企业有 VPN 的需要打开) #iptables -A FORWARD -p gre -s /16 -j ACCEPT
#iptables -A FORWARD -p icmp -s /16 -j ACCEPT
#以下是禁 QQ 的,在网吧的话不要去掉前面的#
#iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
#iptables -I FORWARD -p udp --dport 53 -m string --string tencent -m time --timestart 8:15
--timesto
您可能关注的文档
- How to Configure Virtual Server 2005 in Order to Setup a Test SQL Server Cluster分析和总结分析和总结.docx
- How to improve the air quality分析和总结分析和总结.docx
- How to Refill an Empty Life分析和总结分析和总结.docx
- How to Tell When She Flirts with You分析和总结分析和总结.docx
- hp compaq 510拆机图分析和总结.docx
- HP EML 磁带机更换磁带.docx
- HP MSA2312fc初始化配置分析和总结.docx
- HP Smart Storage Administrator 配置阵列的方法.docx
- HP Smart Storage Administrator 热备盘添加方法.docx
- HP_FC_SAN_Switch配置实例解析.docx
原创力文档


文档评论(0)