linux iptables实验

上传人:第*** 文档编号:32687849 上传时间:2018-02-12 格式:PPT 页数:15 大小:305.50KB
返回 下载 相关 举报
linux iptables实验_第1页
第1页 / 共15页
linux iptables实验_第2页
第2页 / 共15页
linux iptables实验_第3页
第3页 / 共15页
linux iptables实验_第4页
第4页 / 共15页
linux iptables实验_第5页
第5页 / 共15页
点击查看更多>>
资源描述

《linux iptables实验》由会员分享,可在线阅读,更多相关《linux iptables实验(15页珍藏版)》请在金锄头文库上搜索。

1、linux iptables实验,使用虚拟机模拟内外网机器,Linux下使用ifconfig 配置网络接口,ifconfig 可以用来配置网络接口的IP地址、掩码、网关、物理地址等;值得一说的是用ifconfig 为网卡指定IP地址,这只是用来调试网络用的,并不会更改系统关于网卡的配置文件。如果您想把网络接口的IP地址固定下来,目前有三个方法:一是通过各个 发行和版本专用的工具来修改IP地址;二是直接修改网络接口的配置文件;三是修改特定的文件,加入ifconfig 指令来指定网卡的IP地址.,Ifconfig命令,ifconfig 网络端口 IP地址 hw MAC地址 netmask 掩码地址

2、 broadcast 广播地址 up/down rootlinuxchao #ifconfig eth0 downrootlinuxchao #ifconfig eth0 192.168.1.99 broadcast 192.168.1.255 netmask 255.255.255.0rootlinuxchao #ifconfig eth0 uprootlinuxchao #ifconfig eth0,修改配置文件设置ip,/etc/network/interfaces (配置文件位置)使用vi命令写入下面的内容:auto eth0iface eth0 inet static(静止)addr

3、ess 222.222.101.1netmask 255.255.255.0gateway 然后保存退出 重启命令:sudo reboot,dhcp,auto eth0iface eth0 inet dhcp,配置DNS,/etc/resolv.conf nameserver 202.119.230.8,如何用ifconfig 来激活和终止网络接口的连接,激活和终止网络接口的用 ifconfig 命令,后面接网络接口,然后加上 down或up参数,就可以禁止或激活相应的网络接口了。当然也可以用专用工具ifup和ifdown 工具;rootlinuxchao #ifconfig eth0 dow

4、nrootlinuxchao #ifconfig eth0 uprootlinuxchao #ifup eth0rootlinuxchao #ifdown eth0,地址设置,WAN SERVER :222.222.101.2FW WAN:222.222.101.1FW LAN:192.168.222.101LAN CLIENT:192.168.222.102LAN SERVER:192.168.222.103,开启路由功能、实现数据包转发,echo 1 /proc/sys/net/ipv4/ip_forward (默认为0)上面是临时改动Vi etc/sysctl.conf,添加SNAT,I

5、ptables -t nat -A POSTROUTING(包离开前改变其源地址) -s 192.168.222.0/24 -o eth0 -j SNAT -to-source 222.222.101.1,保存iptables设置Service iptables save或建立文件(使其开机自动启动) sudo iptables save /etc/firewall.shEcho sh /etc/firewall.sh | sudo tee a /etc/init.d/rc.local,流媒体服务访问,mms:/222.222.101.2/encoder_ad.wmv使用Netstat an

6、netstat-an :less命令分别检查 内网、外网、的端口情况。,外网访问内网网页服务,DNATIptables -t nat -A PREROUTING(包到达防火墙时改变其目的地址) -p tcp d222.222.101.1 -dport 80 -i eth0 -j DNAT - -to-destination 192.168.222.102,禁止数据包通过,Iptables -t filter -p FORWARD DROPIptables -t filter -p INPUT DROP,允许访问外网特定的服务,Iptables t filter A forward s 192.168.222.0/24 o eth0 p tcp dport 80 j ACCEPTIptables t filter A forward i eth0 p tcp sport 80 j ACCEPT,

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 中学教育 > 职业教育

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号