- 1、本文档共7页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
实验五iptables防火墙实现安全防护和NAT.doc
网络安全与管理
实验报告
实验名称:
学 院: 专业班级: 学 号:
iptables防火墙实现安全防护和NAT
计算机学院
计算机科学与技术四班
14142400808
姓 名: O
指导教师: 刘衍斌
完成日期: 2017年5月8日
一、 实验目的
掌握在iptables中添加、修改和删除规则。
利用iptables防火墙实现网络安全。
二、 实验内容
1.网络拓扑图
PC-PT Web
1 .清除预设表filter中所有规则链中和使用者自定链中的规则
[root(dDogon uesKtopj# service lpraoies stop iptables: Flushing firewall rules: iptables: Setting chains to policy ACCEPT: filter iptables: Unloading modules: [root@bogon Desktop)# iptables [root@boqon Desktop]# iptables [root@bogon Desktop]# iptables [root@bogon Desktop]# iptables [root@bogon Desktop]# iptables [root@bogon Desktop]# iptables [root@bogon Desktop]# iptables iptables: Bad policy name. Run [root@bogon Desktop]# iptables
nat -F
nat -X
nat -Z INPUT DRO
[OK [OK [OK
-P
dmesg* for more information. ?P OUTPUT DROP
[OK[root@bogon Desktop]# service iptables start iptables: Applying firewall rules: [root@bogon Desktop]# iptables -L -n Chain INPUT (policy ACCEPT)
[OK
2设置链的默认策略
首先允许所有的包,然后再禁止有危险的包通过防火墙
I[root@bogon Desktop]# iptables -P INPUT ACCEPT I[root@bogon Desktop]# iptables -P OUTPUT ACCEPT I(root@bogon Desktop]# iptables -p FORWARD ACCEPT liotables vl.4.7: unknown orotocol forward1 soecified
列出链中的所有规则,默认只列出filter表
4?向链中添加规则:
[root@bogon [root@bogon [root@bogon [root@bogon [root@bogonDesktop]# iptables Desktop]# iptables Desktop]# iptables Desktop]# iptables Desktop]# iptables(root@bogon Desktop]# iptables [root@bogon Desktop]# |-A INPUT -i 10 -j ACCEPT
[root@bogon [root@bogon [root@bogon [root@bogon [root@bogon
Desktop]# iptables Desktop]# iptables Desktop]# iptables Desktop]# iptables Desktop]# iptables
(root@bogon Desktop]# iptables [root@bogon Desktop]# |
-A INPUT -i 10 -j ACCEPT
?A OUTPUT ?0 lo ?j ACCEPT
-A INPUT -1 ethO -j ACCEPT -A OUTPUT -o ethl -j ACCEPT -A FORWARD -1 ethl -j ACCEPT -A FORWARD -0 ethl -j ACCEPT
5?使用 iptables 配置 NAT
步骤:
添加基本的NAT地址转换;
添加规则,在这里只添加DROP链,因为默认链全是ACCEPT ,防止外网用内网IP欺
[root@bbogpn Desktop]# iptables -t nat -A PREROUTING -i ethO -s 192.168.3.1 -j
DROP
[root@bbogpn Desktop]# iptables -t nat -A PRE
文档评论(0)