使用教程 最新ROS动态PCQ脚本,2.X 3.X 4.X 全系列 [复制链接]

network
三国LV2
技术中心 7386 1 2010-11-4 12:53:59

PCQ2.X
  1. / ip firewall filter
  2. add chain=output src-address=!192.168.0.0/24 protocol=icmp action=drop \
  3. comment="no net Ping" disabled=no

  4. /ip firewall mangle
  5. add action=mark-packet chain=prerouting comment="\B7\C0UDP\B9\A5\BB\F7" \
  6. disabled=no dst-port=0-65535 new-packet-mark=udp passthrough=yes \
  7. protocol=udp
  8. add action=accept chain=prerouting comment="\CD\E2\BD\D3\CF\DE\CB\D9" \
  9. connection-mark=nolimit disabled=no
  10. add action=mark-connection chain=prerouting comment=\
  11. "\C5\C5\B3\FD\B7\FE\CE\F1\C6\F7\CF\DE\CB\D9" disabled=no \
  12. new-connection-mark=nolimit passthrough=yes src-address=\
  13. 192.168.0.240-192.168.0.253
  14. add action=mark-connection chain=forward comment="P2P\CF\DE\D6\C6" disabled=\
  15. no new-connection-mark=p2pCOM p2p=all-p2p passthrough=yes
  16. add action=mark-packet chain=forward comment="P2P\CF\DE\D6\C6" \
  17. connection-mark=p2pCOM disabled=no new-packet-mark=p2p passthrough=yes
  18. add action=mark-packet chain=prerouting comment=\
  19. "\B1\EA\BC\C7\CB\F9\D3\D0\CA\FD\BE\DD\B0\FC" disabled=no new-packet-mark=\
  20. all-mark passthrough=yes

  21. /queue type
  22. set default kind=pfifo name=default pfifo-limit=50
  23. set ethernet-default kind=pfifo name=ethernet-default pfifo-limit=50
  24. set wireless-default kind=sfq name=wireless-default sfq-allot=1514 \
  25. sfq-perturb=5
  26. set synchronous-default kind=red name=synchronous-default red-avg-packet=1000 \
  27. red-burst=20 red-limit=60 red-max-threshold=50 red-min-threshold=10
  28. set hotspot-default kind=sfq name=hotspot-default sfq-allot=1514 sfq-perturb=\
  29. 5
  30. add kind=pcq name=PCQUP pcq-classifier=src-address pcq-limit=50 pcq-rate=\
  31. 2000000 pcq-total-limit=2000
  32. add kind=pcq name=PCQPUP pcq-classifier=src-address pcq-limit=50 pcq-rate=\
  33. 120000 pcq-total-limit=2000
  34. add kind=pcq name=PCQ8M pcq-classifier=dst-address pcq-limit=50 pcq-rate=\
  35. 8000000 pcq-total-limit=2000
  36. add kind=pcq name=PCQ6M pcq-classifier=dst-address pcq-limit=50 pcq-rate=\
  37. 6000000 pcq-total-limit=2000
  38. add kind=pcq name=PCQ10M pcq-classifier=dst-address pcq-limit=50 pcq-rate=\
  39. 10000000 pcq-total-limit=2000
  40. add kind=pcq name=PCQpppoe pcq-classifier=dst-address pcq-limit=50 pcq-rate=\
  41. 192000 pcq-total-limit=2000
  42. set default-small kind=pfifo name=default-small pfifo-limit=10

  43. / system script
  44. add name="server" source=":for sheng from 240 to 253 do={/queue simple add \
  45. name=\(A . \$sheng\) dst-address=\(192.168.0. . \$sheng\) \
  46. max-limit=3200000/1600000 interface=all disabled=no}" \
  47. policy=ftp,reboot,read,write,policy,test,winbox,password
  48. add name="AUTOarp" source=":foreach i in \[/ip arp find dynamic=yes \] do={/ip arp \
  49. add copy-from=\$i}" \
  50. policy=ftp,reboot,read,write,policy,test,winbox,password
  51. add name="Down40M" source="/interface disable adsl
  52. \n
  53. \n:if \(\[/queue tree \
  54. get \[/queue tree find name="PCQPUP"\] disable \]=false \) do={/queue \
  55. tree disable PCQPUP}
  56. \n
  57. \n\n\n\n\n:if \(\[/queue tree get \[/queue tree \
  58. find name="PCQpppoe"\] disable \]=false \) do={/queue tree disable \
  59. PCQpppoe}
  60. \n
  61. \n\n\n\n\n:if \(\[/queue tree get \[/queue tree find \
  62. name="PCQDown45M"\] disable \]=false \) do={/queue tree disable \
  63. PCQDown45M}
  64. \n
  65. \n\n\n\n\n:if \(\[/queue tree get \[/queue tree find \
  66. name="PCQDown49M"\] disable \]=false \) do={/queue tree disable \
  67. PCQDown49M}
  68. \n
  69. \n\n\n\n\n:if \(\[/queue tree get \[/queue tree find \
  70. name="PCQDown40M"\] disable \]=true \) do={/queue tree enable \
  71. PCQDown40M}
  72. \n
  73. \n\n\n\n\n:if \(\[/queue tree get \[/queue tree find \
  74. name="PCQUP"\] disable \]=true \) do={/queue tree enable \
  75. PCQUP}\n\n\n\n
  76. \n
  77. \n:if \(\[/queue tree get \[/queue tree find \
  78. name="p2pL"\] disable \]=true \) do={/queue tree enable \
  79. p2pL}
  80. \n
  81. \n\n\n\n\n:if \(\[/queue tree get \[/queue tree find \
  82. name="p2pW"\] disable \]=true \) do={/queue tree enable \
  83. p2pW}
  84. \n
  85. \n\n\n\n\n:log info {"dwon 10M"}" \
  86. policy=ftp,reboot,read,write,policy,test,winbox,password
  87. add name="Down45M" source=":if \(\[/queue tree get \[/queue tree find \
  88. name="PCQDown40M"\] disable \]=false \) do={/queue tree disable \
  89. PCQDown40M}
  90. \n
  91. \n\n\n\n\n:if \(\[/queue tree get \[/queue tree find \
  92. name="PCQDown49M"\] disable \]=false \) do={/queue tree disable \
  93. PCQDown49M}
  94. \n
  95. \n\n\n\n\n:if \(\[/queue tree get \[/queue tree find \
  96. name="PCQDown45M"\] disable \]=true \) do={/queue tree enable \
  97. PCQDown45M}
  98. \n
  99. \n\n\n\n\n:log info {"dwon 8M"}" \
  100. policy=ftp,reboot,read,write,policy,test,winbox,password
  101. add name="Down49M" source=":if \(\[/queue tree get \[/queue tree find \
  102. name="PCQDown40M"\] disable \]=false \) do={/queue tree disable \
  103. PCQDown40M}
  104. \n
  105. \n\n\n\n\n:if \(\[/queue tree get \[/queue tree find \
  106. name="PCQDown45M"\] disable \]=false \) do={/queue tree disable \
  107. PCQDown45M}
  108. \n
  109. \n\n\n\n\n:if \(\[/queue tree get \[/queue tree find \
  110. name="PCQDown49M"\] disable \]=true \) do={/queue tree enable \
  111. PCQDown49M}
  112. \n
  113. \n\n\n\n\n:log info {"dwon 6M"}" \
  114. policy=ftp,reboot,read,write,policy,test,winbox,password
  115. add name="PPPOE" source="/interface enable adsl
  116. \n
  117. \n:if \(\[/queue tree get \
  118. \[/queue tree find name="PCQDown40M"\] disable \]=false \) do={/queue \
  119. tree disable PCQDown40M}
  120. \n
  121. \n\n\n\n\n:if \(\[/queue tree get \[/queue \
  122. tree find name="PCQDown45M"\] disable \]=false \) do={/queue tree \
  123. disable PCQDown45M}
  124. \n
  125. \n\n\n\n\n:if \(\[/queue tree get \[/queue tree \
  126. find name="PCQDown49M"\] disable \]=false \) do={/queue tree disable \
  127. PCQDown49M}
  128. \n
  129. \n\n\n\n\n:if \(\[/queue tree get \[/queue tree find \
  130. name="PCQUP"\] disable \]=false \) do={/queue tree disable \
  131. PCQUP}\n\n\n\n
  132. \n
  133. \n:if \(\[/queue tree get \[/queue tree find \
  134. name="p2pL"\] disable \]=false \) do={/queue tree disable \
  135. p2pL}
  136. \n
  137. \n\n\n\n\n:if \(\[/queue tree get \[/queue tree find \
  138. name="p2pW"\] disable \]=false \) do={/queue tree disable \
  139. p2pW}\n\n\n\n
  140. \n
  141. \n:if \(\[/queue tree get \[/queue tree find \
  142. name="PCQpppoe"\] disable \]=true \) do={/queue tree enable \
  143. PCQpppoe}
  144. \n
  145. \n\n\n\n\n:if \(\[/queue tree get \[/queue tree find \
  146. name="PCQPUP"\] disable \]=true \) do={/queue tree enable \
  147. PCQPUP}
  148. \n
  149. \n\n\n\n\n:log info {"down ADSL"}" \
  150. policy=ftp,reboot,read,write,policy,test,winbox,password


  151. / tool traffic-monitor
  152. add name="WanDown40M" interface=wan traffic=received trigger=below \
  153. threshold=40000000 on-event=Down40M comment="" disabled=no
  154. add name="WanDown45M" interface=wan traffic=received trigger=above \
  155. threshold=45000000 on-event=Down45M comment="" disabled=no
  156. add name="WanDown49M" interface=wan traffic=received trigger=above \
  157. threshold=49000000 on-event=Down49M comment="" disabled=no

  158. / queue tree
  159. add name="p2pW" parent=wan packet-mark=p2p limit-at=4000000 queue=default \
  160. priority=8 max-limit=4000000 burst-limit=0 burst-threshold=0 burst-time=0s \
  161. disabled=yes
  162. add name="p2pL" parent=lan packet-mark=p2p limit-at=4000000 queue=default \
  163. priority=8 max-limit=4000000 burst-limit=0 burst-threshold=0 burst-time=0s \
  164. disabled=yes
  165. add name="PCQUP" parent=global-out packet-mark=all-mark limit-at=0 queue=PCQUP \
  166. priority=8 max-limit=0 burst-limit=0 burst-threshold=0 burst-time=0s \
  167. disabled=yes
  168. add name="PCQPUP" parent=global-in packet-mark=all-mark limit-at=0 \
  169. queue=PCQPUP priority=8 max-limit=0 burst-limit=0 burst-threshold=0 \
  170. burst-time=0s disabled=no
  171. add name="PCQDown40M" parent=global-in packet-mark=all-mark limit-at=0 \
  172. queue=PCQ10M priority=8 max-limit=0 burst-limit=0 burst-threshold=0 \
  173. burst-time=0s disabled=yes
  174. add name="PCQDown45M" parent=global-in packet-mark=all-mark limit-at=0 \
  175. queue=PCQ8M priority=8 max-limit=0 burst-limit=0 burst-threshold=0 \
  176. burst-time=0s disabled=yes
  177. add name="PCQDown49M" parent=global-in packet-mark=all-mark limit-at=0 \
  178. queue=PCQ6M priority=8 max-limit=0 burst-limit=0 burst-threshold=0 \
  179. burst-time=0s disabled=yes
  180. add name="PCQpppoe" parent=global-in packet-mark=all-mark limit-at=0 \
  181. queue=PCQpppoe priority=8 max-limit=0 burst-limit=0 burst-threshold=0 \
  182. burst-time=0s disabled=no

  183. / tool netwatch
  184. add host=60.170.90.149 timeout=1s interval=5s up-script=Down40M \
  185. down-script=PPPOE comment="" disabled=no

  186. :for i from=1 to=253 do={/ip firewall filter add chain=forward src-address=("192.168.0." . $i) protocol=tcp connection-limit=200,32 action=drop}
复制代码



2010-11-4 12:56:45

ROS3.X-4.X PCQ


  1. /ip firewall filter
  2. add action=drop chain=output comment="no net Ping" disabled=no protocol=icmp \
  3. src-address=!192.168.0.0/24

  4. /ip firewall mangle
  5. add action=mark-packet chain=prerouting comment="\B7\C0UDP\B9\A5\BB\F7" \
  6. disabled=no dst-port=0-65535 new-packet-mark=udp passthrough=yes \
  7. protocol=udp
  8. add action=accept chain=prerouting comment="\CD\E2\BD\D3\CF\DE\CB\D9" \
  9. connection-mark=nolimit disabled=no
  10. add action=mark-connection chain=prerouting comment=\
  11. "\C5\C5\B3\FD\B7\FE\CE\F1\C6\F7\CF\DE\CB\D9" disabled=no \
  12. new-connection-mark=nolimit passthrough=yes src-address=\
  13. 192.168.0.240-192.168.0.253
  14. add action=mark-connection chain=forward comment="P2P\CF\DE\D6\C6" disabled=\
  15. no new-connection-mark=p2pCOM p2p=all-p2p passthrough=yes
  16. add action=mark-packet chain=forward comment="P2P\CF\DE\D6\C6" \
  17. connection-mark=p2pCOM disabled=no new-packet-mark=p2p passthrough=yes
  18. add action=mark-packet chain=prerouting comment=\
  19. "\B1\EA\BC\C7\CB\F9\D3\D0\CA\FD\BE\DD\B0\FC" disabled=no new-packet-mark=\
  20. all-mark passthrough=yes

  21. /queue type
  22. set default kind=pfifo name=default pfifo-limit=50
  23. set ethernet-default kind=pfifo name=ethernet-default pfifo-limit=50
  24. set wireless-default kind=sfq name=wireless-default sfq-allot=1514 \
  25. sfq-perturb=5
  26. set synchronous-default kind=red name=synchronous-default red-avg-packet=1000 \
  27. red-burst=20 red-limit=60 red-max-threshold=50 red-min-threshold=10
  28. set hotspot-default kind=sfq name=hotspot-default sfq-allot=1514 sfq-perturb=\
  29. 5
  30. add kind=pcq name=PCQUP pcq-classifier=src-address pcq-limit=50 pcq-rate=\
  31. 2000000 pcq-total-limit=2000
  32. add kind=pcq name=PCQ6M pcq-classifier=dst-address pcq-limit=50 pcq-rate=\
  33. 8000000 pcq-total-limit=2000
  34. add kind=pcq name=PCQ10M pcq-classifier=dst-address pcq-limit=50 pcq-rate=\
  35. 10000000 pcq-total-limit=2000
  36. add kind=pcq name=PCQ20M pcq-classifier=dst-address pcq-limit=50 pcq-rate=\
  37. 20000000 pcq-total-limit=2000
  38. add kind=pcq name=PCQPUP pcq-classifier=src-address pcq-limit=50 pcq-rate=\
  39. 120000 pcq-total-limit=2000
  40. add kind=pcq name=PCQpppoe pcq-classifier=dst-address pcq-limit=50 pcq-rate=\
  41. 192000 pcq-total-limit=2000
  42. set default-small kind=pfifo name=default-small pfifo-limit=10

  43. /system script
  44. add name=auto-arp policy=\
  45. ftp,reboot,read,write,policy,test,winbox,password,sniff source=":foreach i\
  46. \_in [/ip arp find dynamic=yes ] do={/ip arp add copy-from=\$i}"
  47. add name=Down40M policy=\
  48. ftp,reboot,read,write,policy,test,winbox,password,sniff source="/interface\
  49. \_disable adsl\r\
  50. \n\r\
  51. \n:if ([/queue tree get [/queue tree find name="PCQpppoe"] disable ]=fal\
  52. se ) do={/queue tree disable PCQpppoe}\r\
  53. \n\r\
  54. \n:if ([/queue tree get [/queue tree find name="PCQPUP"] disable ]=false\
  55. \_) do={/queue tree disable PCQPUP}\r\
  56. \n\r\
  57. \n:if ([/queue tree get [/queue tree find name="PCQDown45M"] disable ]=f\
  58. alse ) do={/queue tree disable PCQDown45M}\r\
  59. \n\r\
  60. \n:if ([/queue tree get [/queue tree find name="PCQDown49M"] disable ]=f\
  61. alse ) do={/queue tree disable PCQDown49M}\r\
  62. \n\r\
  63. \n:if ([/queue tree get [/queue tree find name="PCQDown40M"] disable ]=t\
  64. rue ) do={/queue tree enable PCQDown40M}\r\
  65. \n\r\
  66. \n:if ([/queue tree get [/queue tree find name="p2pL"] disable ]=true ) \
  67. do={/queue tree enable p2pL}\r\
  68. \n\r\
  69. \n:if ([/queue tree get [/queue tree find name="p2pW"] disable ]=true ) \
  70. do={/queue tree enable p2pW}\r\
  71. \n\r\
  72. \n:log info "\A1\BC\D2\D1\C7\D0\BB\BB\B3\C9 \B6\AF\CC\AC\CF\C2\D4\D8 \B8\
  73. \DF\CB\D9\A1\BD"}"
  74. add name=Down45M policy=\
  75. ftp,reboot,read,write,policy,test,winbox,password,sniff source=":if ([/que\
  76. ue tree get [/queue tree find name="PCQDown35M"] disable ]=false ) do={/\
  77. queue tree disable PCQDown35M}\r\
  78. \n\r\
  79. \n:if ([/queue tree get [/queue tree find name="PCQDown49M"] disable ]=f\
  80. alse ) do={/queue tree disable PCQDown49M}\r\
  81. \n\r\
  82. \n:if ([/queue tree get [/queue tree find name="PCQDown45M"] disable ]=t\
  83. rue ) do={/queue tree enable PCQDown45M}\r\
  84. \n\r\
  85. \n:log info "\A1\BC\D2\D1\C7\D0\BB\BB\B3\C9 \B6\AF\CC\AC\CF\C2\D4\D8 \D6\
  86. \D0\CB\D9\A1\BD"}"
  87. add name=Down49M policy=\
  88. ftp,reboot,read,write,policy,test,winbox,password,sniff source=":if ([/que\
  89. ue tree get [/queue tree find name="PCQDown35M"] disable ]=false ) do={/\
  90. queue tree disable PCQDown35M}\r\
  91. \n\r\
  92. \n:if ([/queue tree get [/queue tree find name="PCQDown45M"] disable ]=f\
  93. alse ) do={/queue tree disable PCQDown45M}\r\
  94. \n\r\
  95. \n:if ([/queue tree get [/queue tree find name="PCQDown49M"] disable ]=t\
  96. rue ) do={/queue tree enable PCQDown49M}\r\
  97. \n\r\
  98. \n:log info "\A1\BC\D2\D1\C7\D0\BB\BB\B3\C9 \B6\AF\CC\AC\CF\C2\D4\D8 \B5\
  99. \CD\CB\D9\A1\BD"}"
  100. add name=PPPOE policy=\
  101. ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive source="\
  102. /interface enable adsl\r\
  103. \n\r\
  104. \n:if ([/queue tree get [/queue tree find name="p2pL"] disable ]=false )\
  105. \_do={/queue tree disable p2pL}\r\
  106. \n\r\
  107. \n:if ([/queue tree get [/queue tree find name="p2pW"] disable ]=false )\
  108. \_do={/queue tree disable p2pW}\r\
  109. \n\r\
  110. \n:if ([/queue tree get [/queue tree find name="PCQDown40M"] disable ]=f\
  111. alse ) do={/queue tree disable PCQDown40M}\r\
  112. \n\r\
  113. \n:if ([/queue tree get [/queue tree find name="PCQUP"] disable ]=false \
  114. ) do={/queue tree disable PCQUP}\r\
  115. \n\r\
  116. \n:if ([/queue tree get [/queue tree find name="PCQDown45M"] disable ]=f\
  117. alse ) do={/queue tree disable PCQDown45M}\r\
  118. \n\r\
  119. \n:if ([/queue tree get [/queue tree find name="PCQDown49M"] disable ]=f\
  120. alse ) do={/queue tree disable PCQDown49M}\r\
  121. \n\r\
  122. \n:if ([/queue tree get [/queue tree find name="PCQPUP"] disable ]=true \
  123. ) do={/queue tree enable PCQPUP}\r\
  124. \n\r\
  125. \n:if ([/queue tree get [/queue tree find name="PCQpppoe"] disable ]=tru\
  126. e ) do={/queue tree enable PCQpppoe}\r\
  127. \n\r\
  128. \n:log info "\A1\BC\D2\D1\C7\D0\BB\BB\B3\C9 \B6\AF\CC\AC\CF\C2\D4\D8 ADSL\
  129. \A1\BD"}"
  130. add name=TCP/IP policy=\
  131. ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive source="\
  132. :for i from=1 to=253 do={/ip firewall filter add chain=forward src-address\
  133. =("192.168.0." . \$i) protocol=tcp connection-limit=200,32 action=drop}"
  134. add name=server policy=\
  135. ftp,reboot,read,write,policy,test,winbox,password,sniff,sensitive source="\
  136. :for i from=240 to=253 do={/queue simple add name=("A" . \$i) dst-addres\
  137. s=("192.168.0.". \$i) max-limit=400000/200000 interface=all disabled=no}\
  138. \r\
  139. \n"

  140. /tool traffic-monitor
  141. add comment="" disabled=no interface=wan name=WanDown40M on-event=Down40M \
  142. threshold=40000000 traffic=received trigger=below
  143. add comment="" disabled=no interface=wan name=WanDown45M on-event=Down45M \
  144. threshold=40000000 traffic=received trigger=above
  145. add comment="" disabled=no interface=wan name=WanDown49M on-event=Down49M \
  146. threshold=48000000 traffic=received trigger=above

  147. /queue tree
  148. add burst-limit=0 burst-threshold=0 burst-time=0s disabled=yes limit-at=4M \
  149. max-limit=4M name=p2pW packet-mark=p2p parent=wan priority=8 queue=\
  150. default
  151. add burst-limit=0 burst-threshold=0 burst-time=0s disabled=yes limit-at=0 \
  152. max-limit=0 name=PCQUP packet-mark=all-mark parent=global-out priority=8 \
  153. queue=PCQUP
  154. add burst-limit=0 burst-threshold=0 burst-time=0s disabled=yes limit-at=0 \
  155. max-limit=0 name=PCQDown40M packet-mark=all-mark parent=global-in \
  156. priority=8 queue=PCQ20M
  157. add burst-limit=0 burst-threshold=0 burst-time=0s disabled=yes limit-at=0 \
  158. max-limit=0 name=PCQDown45M packet-mark=all-mark parent=global-in \
  159. priority=8 queue=PCQ10M
  160. add burst-limit=0 burst-threshold=0 burst-time=0s disabled=yes limit-at=0 \
  161. max-limit=0 name=PCQDown49M packet-mark=all-mark parent=global-in \
  162. priority=8 queue=PCQ6M
  163. add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
  164. max-limit=0 name=PCQPUP packet-mark=all-mark parent=global-out priority=8 \
  165. queue=PCQPUP
  166. add burst-limit=0 burst-threshold=0 burst-time=0s disabled=no limit-at=0 \
  167. max-limit=0 name=PCQpppoe packet-mark=all-mark parent=global-in priority=\
  168. 8 queue=PCQpppoe
  169. add burst-limit=0 burst-threshold=0 burst-time=0s disabled=yes limit-at=4M \
  170. max-limit=4M name=p2pL packet-mark=p2p parent=lan priority=8 queue=\
  171. default

  172. /tool netwatch
  173. add comment="" disabled=no down-script=PPPOE host=60.170.89.74 interval=5s \
  174. timeout=1s up-script=Down40M

复制代码

您需要登录后才可以回帖 立即登录
高级模式
返回
统计信息
  • 会员数: 29041 个
  • 话题数: 9627 篇
  • 巅峰数: 5500 人