Linux主机iptables,Linux下主机充当防火墙的巧妙应用之iptables

[root@gjp99 ~]# iptables -I FORWARD 2 -m iprange --src-range 192.168.2.21-192.168.2.30 -mtime --timestart 08:00 --timestop 20:00 --weekdays Mon,Tue,Wed,Thu,Fri -m layer7 --l7proto xunlei -j DROP

同种方法,可禁止其他的,许多!例如pplive 电驴,msn 等等! 前提必须在这个目录下存在的!否则,不支持

shell> iptables -A FORWARD -m layer7 --l7proto msnmessenger -j DROP

shell> iptables -A FORWARD -m layer7 --l7proto msn-filetransfer -j DROP  //MSN聊天工具

shell> iptables -A FORWARD -m layer7 --l7proto xunlei -j DROP       //迅雷下载

shell> iptables -A FORWARD -m layer7 --l7proto edonkey -j DROP   //电驴下载

shell> iptables -A FORWARD -m layer7 --l7proto bittorrent -j DROP   //BT下载

[root@gjp99 protocols]# pwd

/etc/l7-protocols/protocols

控制最大连接数3(限制打开的窗口数量,一个窗口可能有多个连接)

[root@gjp99 protocols]# iptables -I FORWARD 2 -m iprange --src-range 192.168.2.21-192.168.2.30 -mtime --timestart 08:00 --timestop 20:00 --weekdays Mon,Tue,Wed,Thu,Fri -p tcp --syn --dport 80 -m connlimit --connlimit-above 3  -j DROP

五、经理办公室:

http  qq 都可以,下班后无限制

dmz区域www服务器进行发布

1.允许http qq 上网!

[root@gjp99 protocols]# iptables -A FORWARD  -m iprange --src-range 192.168.2.31-192.168.2.40 -mtime --timestart 08:00 --timestop 20:00 --weekdays Mon,Tue,Wed,Thu,Fri -p udp --dport 53 -j ACCEPT

[root@gjp99 protocols]# iptables -A FORWARD  -m iprange --src-range 192.168.2.31-192.168.2.40 -mtime --timestart 08:00 --timestop 20:00 --weekdays Mon,Tue,Wed,Thu,Fri -p tcp --dport 80 -j ACCEPT

[root@gjp99 protocols]# iptables -A FORWARD  -m iprange --src-range 192.168.2.31-192.168.2.40 -mtime --timestart 08:00 --timestop 20:00 --weekdays Mon,Tue,Wed,Thu,Fri -m layer7 --l7proto qq -j ACCEPT

[root@gjp99 ~]# iptables -A FORWARD  -m iprange --src-range 192.168.2.31-192.168.2.40 -mtime --timestart 08:00 --timestop 20:00 --weekdays Mon,Tue,Wed,Thu,Fri -p  icmp -j ACCEPT

8c0138822dcb6220dabd8845b6e9aa7d.png

DNS解析(53)

60b2cfa023d60f7f612ecd9aa548461d.png

http:(80)

da5be8b4b21de7e83759249c34c837d8.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值