1---layer7 match #基本过滤不掉什么东东
iptables -A FORWARD -m layer7 --l7proto qq -j DROP
iptables -A FORWARD -m layer7 --l7proto msnmessenger -j DROP
iptables -A FORWARD -m layer7 --l7proto msn-filetransfer -j DROP
iptables -A FORWARD -m layer7 --l7proto xunlei -j DROP
2---string match #匹配网页中类似 这类网址
iptables -A FORWARD -p udp --dport 53 -m string --string "qq" --algo bm -j DROP
3---state match
iptables -A FORWARD -m state --state NEW -p tcp ! --syn -j DROP
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
4---connlimit match
iptables -A FORWARD -p tcp --syn -m connlimit --connlimit-above 100 --connlimit-mask 24 -j DROP
5---time match
iptables -A FORWARD -p tcp --dport 80 -m time --timestart 8:00 --timestop 17:00 --weekdays Mon,Tue,Wed,Thu,Fri -j ACCEPT
=====================
使用实例
#!/bin/bash
/etc/init.d/iptables stop
sudo /sbin/iptables -t nat -I POSTROUTING -s 192.168.168.0/24 -o eth0 -j MASQUERADE
iptables -I FORWARD -m layer7 --l7proto http -m time --timestart 8:00 --timestop 10:00 -m iprange --src-range 192.168.168.1-192.168.168.10 -j DROP
iptables -I FORWARD -m layer7 --l7proto http -m time --timestart 10:01 --timestop 11:00 -m iprange --src-range 192.168.168.1-192.168.168.10 -j ACCEPT
iptables -I FORWARD -p udp --dport 53 -m string --string "qq" --algo bm -m iprange --src-range 192.168.168.1-192.168.168.10 -j DROP
阅读(1193) | 评论(0) | 转发(0) |