1、本脚本为网吧通用防火墙,导入命令:im *.RSC请复制以下代码,保存为*.rsc-/ ip firewall connection tracking set enabled=yes tcp-syn-sent-timeout=5s tcp-syn-received-timeout=30s tcp-established-timeout=5d tcp-fin-wait-timeout=2m tcp-close-wait-timeout=1m tcp-last-ack-timeout=30s tcp-time-wait-timeout=2m tcp-close-timeout=10s udp-ti
2、meout=30s udp-stream-timeout=3m icmp-timeout=30s generic-timeout=10m / ip firewall filter add chain=input connection-state=invalid action=drop comment=“drop invalid packets“ disabled=no add chain=input connection-state=related action=accept comment=“accept related packets“ disabled=no add chain=inpu
3、t connection-state=established action=accept comment=“accept established packets“ disabled=no add chain=input protocol=tcp psd=21,3s,3,1 action=drop comment=“detect and drop port scan connections“ disabled=no add chain=input protocol=tcp connection-limit=3,32 src-address-list=black_list action=tarpi
4、t comment=“suppress DoS attack“ disabled=no add chain=input protocol=tcp connection-limit=10,32 action=add-src-to-address-list address-list=black_list address-list-timeout=1d comment=“detect DoS attack“ disabled=no add chain=input dst-address-type=!local action=drop comment=“drop all that is not to
5、local“ disabled=no add chain=input src-address-type=!unicast action=drop comment=“drom all that is not from unicast“ disabled=no add chain=input protocol=icmp action=jump jump-target=ICMP comment=“jump to chain ICMP“ disabled=no add chain=input action=jump jump-target=services comment=“jump to chain
6、 services“ disabled=no add chain=services protocol=tcp dst-port=53 action=accept comment=“allow DNS request“ disabled=no add chain=services protocol=udp dst-port=53 action=accept comment=“Allow DNS request“ disabled=no add chain=services src-address=127.0.0.1 dst-address=127.0.0.1 action=accept comm
7、ent=“accept localhost“ disabled=no add chain=services protocol=tcp dst-port=20-21 action=accept comment=“allow ftp“ disabled=no add chain=services protocol=tcp dst-port=22 action=accept comment=“allow sftp, ssh“ disabled=no add chain=services protocol=tcp dst-port=23 action=accept comment=“allow tel
8、net“ disabled=no add chain=services protocol=tcp dst-port=80 action=accept comment=“allow http, webbox“ disabled=no add chain=services protocol=tcp dst-port=8291 action=accept comment=“Allow winbox“ disabled=no add chain=services protocol=udp dst-port=20561 action=accept comment=“allow MACwinbox “ d
9、isabled=no add chain=services protocol=tcp dst-port=2000 action=accept comment=“Bandwidth server“ disabled=no add chain=services protocol=udp dst-port=5678 action=accept comment=“ MT Discovery Protocol“ disabled=no add chain=services protocol=udp dst-port=1701 action=accept comment=“allow L2TP“ disa
10、bled=no add chain=services protocol=tcp dst-port=1723 action=accept comment=“allow PPTP“ disabled=no add chain=services protocol=gre action=accept comment=“allow PPTP and EoIP“ disabled=no add chain=services protocol=ipencap action=accept comment=“allow IPIP“ disabled=no add chain=services protocol=
11、udp dst-port=1900 action=accept comment=“UPnP“ disabled=no add chain=services protocol=tcp dst-port=2828 action=accept comment=“UPnP“ disabled=no add chain=services protocol=udp dst-port=67-68 action=accept comment=“allow DHCP“ disabled=no add chain=services protocol=tcp dst-port=8080 action=accept
12、comment=“allow Web Proxy“ disabled=no add chain=services protocol=tcp dst-port=123 action=accept comment=“allow NTP“ disabled=no add chain=services protocol=tcp dst-port=161 action=accept comment=“allow SNMP“ disabled=no add chain=services protocol=tcp dst-port=443 action=accept comment=“allow https
13、 for Hotspot“ disabled=no add chain=services protocol=tcp dst-port=1080 action=accept comment=“allow Socks for Hotspot“ disabled=no add chain=services protocol=udp dst-port=500 action=accept comment=“allow IPSec connections“ disabled=no add chain=services protocol=ipsec-esp action=accept comment=“al
14、low IPSec“ disabled=no add chain=services protocol=ipsec-ah action=accept comment=“allow IPSec“ disabled=no add chain=services protocol=tcp dst-port=179 action=accept comment=“Allow BGP“ disabled=no add chain=services protocol=udp dst-port=520-521 action=accept comment=“allow RIP“ disabled=no add ch
15、ain=services protocol=ospf action=accept comment=“allow OSPF“ disabled=no add chain=services protocol=udp dst-port=5000-5100 action=accept comment=“allow BGP“ disabled=no add chain=services protocol=tcp dst-port=1720 action=accept comment=“allow Telephony“ disabled=no add chain=services protocol=udp
16、 dst-port=1719 action=accept comment=“allow Telephony“ disabled=no add chain=forward connection-state=invalid action=drop comment=“drop invalid packets“ disabled=no add chain=forward connection-state=related action=accept comment=“accept related packets“ disabled=no add chain=forward connection-stat
17、e=established action=accept comment=“accept established packets“ disabled=no add chain=forward src-address-type=!unicast action=drop comment=“drop all that is not from unicast“ disabled=no add chain=forward protocol=icmp action=jump jump-target=ICMP comment=“jump to chain ICMP“ disabled=no add chain
18、=forward action=jump jump-target=virus comment=“jump to virus chain“ disabled=no add chain=forward action=accept comment=“Accept everything else“ disabled=no add chain=output protocol=tcp dst-port=53 action=accept comment=“allow DNS request“ disabled=no add chain=output protocol=udp dst-port=53 acti
19、on=accept comment=“Allow DNS request“ disabled=no add chain=output connection-state=invalid action=drop comment=“drop invalid packets“ disabled=no add chain=output connection-state=related action=accept comment=“accept related packets“ disabled=no add chain=output connection-state=established action
20、=accept comment=“accept established packets“ disabled=no add chain=output protocol=icmp action=accept comment=“ disabled=no add chain=output action=drop comment=“Drop all connections from this router“ disabled=no add chain=virus protocol=tcp dst-port=135-139 action=drop comment=“Drop Blaster Worm“ d
21、isabled=no add chain=virus protocol=udp dst-port=135-139 action=drop comment=“Drop Messenger Worm“ disabled=no add chain=virus protocol=tcp dst-port=445 action=drop comment=“Drop Blaster Worm“ disabled=no add chain=virus protocol=udp dst-port=445 action=drop comment=“Drop Blaster Worm“ disabled=no a
22、dd chain=virus protocol=tcp dst-port=593 action=drop comment=“_“ disabled=no add chain=virus protocol=tcp dst-port=1024-1030 action=drop comment=“_“ disabled=no add chain=virus protocol=tcp dst-port=1080 action=drop comment=“Drop MyDoom“ disabled=no add chain=virus protocol=tcp dst-port=1214 action=
23、drop comment=“_“ disabled=no add chain=virus protocol=tcp dst-port=1363 action=drop comment=“ndm requester“ disabled=no add chain=virus protocol=tcp dst-port=1364 action=drop comment=“ndm server“ disabled=no add chain=virus protocol=tcp dst-port=1368 action=drop comment=“screen cast“ disabled=no add
24、 chain=virus protocol=tcp dst-port=1373 action=drop comment=“hromgrafx“ disabled=no add chain=virus protocol=tcp dst-port=1377 action=drop comment=“cichlid“ disabled=no add chain=virus protocol=tcp dst-port=1433-1434 action=drop comment=“Worm“ disabled=no add chain=virus protocol=tcp dst-port=2745 a
25、ction=drop comment=“Bagle Virus“ disabled=no add chain=virus protocol=tcp dst-port=2283 action=drop comment=“Drop Dumaru.Y“ disabled=no add chain=virus protocol=tcp dst-port=2535 action=drop comment=“Drop Beagle“ disabled=no add chain=virus protocol=tcp dst-port=2745 action=drop comment=“Drop Beagle
26、.C-K“ disabled=no add chain=virus protocol=tcp dst-port=3127-3128 action=drop comment=“Drop MyDoom“ disabled=no add chain=virus protocol=tcp dst-port=3410 action=drop comment=“Drop Backdoor OptixPro“ disabled=no add chain=virus protocol=tcp dst-port=4444 action=drop comment=“Worm“ disabled=no add ch
27、ain=virus protocol=udp dst-port=4444 action=drop comment=“Worm“ disabled=no add chain=virus protocol=tcp dst-port=5554 action=drop comment=“Drop Sasser“ disabled=no add chain=virus protocol=tcp dst-port=8866 action=drop comment=“Drop Beagle.B“ disabled=no add chain=virus protocol=tcp dst-port=9898 a
28、ction=drop comment=“Drop Dabber.A-B“ disabled=no add chain=virus protocol=tcp dst-port=10000 action=drop comment=“Drop Dumaru.Y“ disabled=no add chain=virus protocol=tcp dst-port=10080 action=drop comment=“Drop MyDoom.B“ disabled=no add chain=virus protocol=tcp dst-port=12345 action=drop comment=“Dr
29、op NetBus“ disabled=no add chain=virus protocol=tcp dst-port=17300 action=drop comment=“Drop Kuang2“ disabled=no add chain=virus protocol=tcp dst-port=27374 action=drop comment=“Drop SubSeven“ disabled=no add chain=virus protocol=tcp dst-port=65506 action=drop comment=“Drop PhatBot, Gaobot“ disabled
30、=no-2.禁止外网 ping 路由/ ip firewall filter add chain=input src-address=!192.168.0.0/24 protocol=icmp action=drop comment=“No wan Ping“3.防止灰鸽子木马/ ip firewall filteradd chain=forward protocol=tcp dst-port=1999 action=drop comment=“Backdoor.GrayBird.ad“add chain=forward dst-address=80.190.240.125 action=dr
31、opadd chain=forward dst-address=203.209.245.168 action=dropadd chain=forward dst-address=210.192.122.106 action=dropadd chain=forward dst-address=218.30.88.43 action=dropadd chain=forward dst-address=219.238.233.110 action=dropadd chain=forward dst-address=222.186.8.88 action=dropadd chain=forward d
32、st-address=124.42.125.37 action=dropadd chain=forward dst-address=210.192.122.107 action=dropadd chain=forward dst-address=61.147.118.198 action=dropadd chain=forward dst-address=219.238.233.11 action=drop4.禁止 P2P 电驴下载/ ip firewall filteradd chain=forward protocol=tcp dst-port=4661-4662 action=drop
33、comment=“No Emule“add chain=forward protocol=tcp dst-port=4242 action=dropadd chain=forward dst-address=62.241.53.15 action=drop5.禁止比特精灵下载(BitSpirit)/ ip firewall filteradd chain=forward protocol=tcp dst-port=16881 action=drop comment=“No BitSpirit“6.禁止 PPLIVE 网络电视/ ip firewall filteradd chain=forwa
34、rd protocol=tcp dst-port=8008 action=drop comment=“No PPlive TV“add chain=forward protocol=udp dst-port=4004 action=dropadd chain=forward dst-address=218.108.237.11 action=drop7.禁止 vagaa(哇嘎)/ ip firewall filteradd chain=forward content= action=reject comment=“No VaGaa“add chain=forward content= acti
35、on=rejectadd chain=forward protocol=tcp dst-port=40750 action=dropadd chain=forward protocol=udp dst-port=40750 action=dropadd chain=forward protocol=tcp dst-port=2004 action=dropadd chain=forward protocol=udp dst-port=2004 action=dropadd chain=forward protocol=tcp dst-port=2005 action=dropadd chain
36、=forward protocol=udp dst-port=2005 action=dropadd chain=forward protocol=tcp dst-port=16521 action=dropadd chain=forward protocol=udp dst-port=16521 action=drop8.解决网页断流现象网页断流,就是说内网 TCP 传输具有时效性,不能保存过久,包一多路由就负担了,太短就是变连接不上了。游戏的 TCP 包就不存在这样的问题,因为游戏包小,时时通信,即使被刷新失效,马上也会有的。网页就不一样的了,有时候发现网页打不开,其它都正常这个就叫网页断
37、流网页断流几个关系的问题:8.1.tracking 问题 使用本站提供的,保证无问题,一个 SYN 推荐大家调高一点点为好/ ip firewall connection tracking set enabled=yes tcp-syn-sent-timeout=5s tcp-syn-received-timeout=30s tcp-established-timeout=5d tcp-fin-wait-timeout=2m tcp-close-wait-timeout=1m tcp-last-ack-timeout=30s tcp-time-wait-timeout=2m tcp-close-timeout=10s udp-timeout=30s udp-stream-timeout=3m icmp-timeout=30s generic-timeout=10mip firewall connection tracking 的图8.2.防火墙问题 防火墙把 TCP3129-3198 给禁用了 删除 31XX 一系列规则8.3.Queue Tree 限制线程问题这里说明下,我们只限制速度,不限制线程数为好