- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
IPTABLES 配置一实例 2007-10-10 17:19分类:LINUX 学习笔记字号:
IPTABLES 配置一实例 2007-10-10 17:19
以下是在 REDHAT AS 4 U4 上试验过,其中 eth0 接外网,eth1 接内网。
echo Enable IP Forwarding echo 1 /proc/sys/net/ipv4/ip_forward
echo Starting iptables rules.
/sbin/modprobe ip_tables
/sbin/modprobe ip_conntrack
/sbin/modprobe iptable_nat
/sbin/modprobe ip_conntrack_ftp #支持 FTP 跟踪连接
/sbin/modprobe ip_nat_ftp #支持FTP 被动模式连接
################################### 清除规则
iptables -F iptables -X iptables -Z
#####################################
iptables -F -t nat iptables -Z -t nat iptables -X -t nat
###################################不允许所有的ICMP 数据传输,但允许 ping
iptables -A INPUT -p icmp --icmp-type 0 -j ACCEPT iptables -A INPUT -p icmp --icmp-type 3 -j ACCEPT iptables -A INPUT -p icmp --icmp-type 5 -j ACCEPT iptables -A INPUT -p icmp --icmp-type 11 -j ACCEPT
iptables -A INPUT -p icmp --icmp-type 8 -m limit --limit 1/s -j ACCEPT
#################################### 设置默认规则
iptables -P INPUT DROP iptables -P FORWARD DROP iptables -P OUTPUT ACCEPT
####################################
iptables -A INPUT -i lo -j ACCEPT (进入本机,即防火墙那机的包可接收)
iptables -A OUTPUT -o lo -j ACCEPT (允许本机出去)
iptables -A OUTPUT -o eth0 -j ACCEPT (匹配从 eth0 网卡出去的包,可访问外网)
iptables -A INPUT -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT (出去后返回的
已建立的连接包可以接收)
iptables -A INPUT -i eth1 -s /24 -j ACCEPT (匹配从 eth1 网卡进来,并且是来自
网段的)
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT (允许包从 eth1 网卡转发到 eth0 网卡)
iptables -A FORWARD -i eth0 -o eth1 -m state --state ESTABLISHED,RELATED -j ACCEPT
(以建立连接包,允许从 eth0 转发到 eth1)
##############################33
iptables -t nat -P POSTROUTING ACCEPT iptables -t nat -P PREROUTING ACCEPT iptables -t nat -P OUTPUT ACCEPT
####################################333
iptables -A FORWARD -s /24 -j ACCEPT(来自 网段的包都允以转发) iptables -A FORWARD -i eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT ##########################################################3
iptables -A INPUT -i eth0 -p tcp -m multiport --dports 80,110,21,22,3389 -j ACCEP
您可能关注的文档
- 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
- HP1100常见故障与排除.docx
- hp原厂预装win8更换win7如何设置.docx
- HR PAYROLL 薪资报表案例.docx
最近下载
- 新人教版八年级上册英语 八上unit 6 课文原文语法填空+练习 教师版.docx VIP
- 中国历史地理2014 第三讲空谷足音.pdf VIP
- 中国历史地理第四讲 江河之变2 .pdf VIP
- 北大-中国历史地理-第三讲 古代交通第三讲3.ppt VIP
- GZSMARTS_2—2018智慧园区建设与验收技术规范 2018 14页.pdf VIP
- 2016年造价工程师《造价管理》常考题(四).pdf VIP
- 压力检测仪表校验 BT200手持操作器组态设置(化工仪表检验课件).pptx
- 老旧小区改造知识课件.pptx
- 裂纹愈合热障涂层粉体材料的制备方法.pdf VIP
- 运筹学教程第五版胡运权课后习题答案.docx
原创力文档


文档评论(0)