找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 4967|回复: 7

[脚本] 各位老大 麻烦进来看看这个脚本

[复制链接]
发表于 2010-5-15 20:32:44 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
这是别人给我用的脚本  100M光纤带160台机器


############################定义PCQ动态分配带宽值#################################
/ queue type
add name="PCQ-up"     kind=pcq pcq-rate=3000000 pcq-limit=50 pcq-classifier=src-address pcq-total-limit=2000
add name="PCQ-down" kind=pcq pcq-rate=3000000 pcq-limit=50 pcq-classifier=dst-address pcq-total-limit=2000
############################定义PCQ动态分配带宽值#################################

红色部分是想每台电脑最大使用的带宽,我的是3M.可根据自己情况手动改!







数据包优化





############################需要优化的数据包的范围#################################
/ ip firewall mangle
add chain=prerouting action=mark-connection new-connection-mark=all_con passthrough=yes comment="" disabled=no
add chain=prerouting connection-mark=all_con action=mark-packet new-packet-mark=all passthrough=yes comment="" \
    disabled=no
add chain=prerouting packet-size=0-512 action=mark-connection new-connection-mark=small_con passthrough=yes comment="" \
    disabled=no
add chain=prerouting connection-mark=small_con packet-size=0-512 action=mark-packet new-packet-mark=small \
    passthrough=yes comment="" disabled=no
add chain=prerouting packet-size=513-1000 action=mark-connection new-connection-mark=middle_con passthrough=yes \
    comment="" disabled=no
add chain=prerouting connection-mark=middle_con packet-size=513-1000 action=mark-packet new-packet-mark=middle \
    passthrough=yes comment="" disabled=no
add chain=prerouting packet-size=1001-1300 action=mark-connection new-connection-mark=middle_con2 passthrough=yes \
    comment="" disabled=no
add chain=prerouting connection-mark=middle_con2 packet-size=1001-1300 action=mark-packet new-packet-mark=middle2 \
    passthrough=yes comment="" disabled=no
add chain=prerouting protocol=tcp packet-size=1301-1500 action=mark-connection new-connection-mark=BIG_CON \
    passthrough=yes comment="" disabled=no
add chain=prerouting connection-mark=BIG_CON action=mark-packet new-packet-mark=BIG passthrough=yes comment="" \
    disabled=no
add chain=prerouting protocol=icmp action=mark-connection new-connection-mark=icmp_con passthrough=yes comment="" \
    disabled=no
add chain=prerouting connection-mark=icmp_con action=mark-packet new-packet-mark=icmp passthrough=yes comment="" \
    disabled=no
add chain=prerouting protocol=udp packet-size=1301-1500 action=mark-connection new-connection-mark=udpbig_con \
    passthrough=yes comment="" disabled=no
add chain=prerouting connection-mark=udpbig_con action=mark-packet new-packet-mark=udpbig passthrough=yes comment="" \
    disabled=no
############################需要优化的数据包的范围###################################

这一行别动他.直接复制贴进ros






数据包优先

############################定义需要优先的数据包####################################
/ queue simple
add name="icmp-pckj" dst-address=0.0.0.0/0 interface=all parent=none \
    packet-marks=icmp priority=1 queue=default/default limit-at=0/0 \
    max-limit=0/0 total-queue=default disabled=no
add name="small-pckj" dst-address=0.0.0.0/0 interface=all parent=none \
    packet-marks=small priority=2 queue=default/default limit-at=0/0 \
    max-limit=0/0 total-queue=default disabled=no
add name="middle-pckj" dst-address=0.0.0.0/0 interface=all parent=none \
    packet-marks=middle priority=3 queue=default/default limit-at=0/0 \
    max-limit=0/0 total-queue=default disabled=no
add name="PCQ-PCKJ" target-addresses=192.168.1.0/24 dst-address=0.0.0.0/0 \
    interface=all parent=none priority=8 queue=PCQ-up/PCQ-down limit-at=0/0 \
    max-limit=18000000/18000000 total-queue=default disabled=no
add name="middle2-pckj" dst-address=0.0.0.0/0 interface=all parent=PCQ-PCKJ \
    packet-marks=middle2 priority=4 queue=PCQ-up/PCQ-down limit-at=0/0 \
    max-limit=0/0 total-queue=default disabled=no
add name="big-pckj" dst-address=0.0.0.0/0 interface=all parent=PCQ-PCKJ \
    packet-marks=BIG priority=6 queue=PCQ-up/PCQ-down limit-at=0/0 \
    max-limit=0/0 total-queue=default disabled=no
add name="udpbig-pckj" dst-address=0.0.0.0/0 interface=all parent=PCQ-PCKJ \
    packet-marks=udpbig priority=7 queue=PCQ-up/PCQ-down limit-at=0/0 \
    max-limit=0/0 total-queue=default disabled=no
routeros
 楼主| 发表于 2010-5-15 20:33:22 | 显示全部楼层
1   这个脚本可以不可以这样理解

/ queue type
add name="PCQ-up"     kind=pcq pcq-rate=30000000 pcq-limit=50 pcq-classifier=src-address pcq-total-limit=2000
add name="PCQ-down" kind=pcq pcq-rate=30000000 pcq-limit=50 pcq-classifier=dst-address pcq-total-limit=2000



add name="PCQ-PCKJ" target-addresses=192.168.1.0/24 dst-address=0.0.0.0/0 \
    interface=all parent=none priority=8 queue=PCQ-up/PCQ-down limit-at=0/0 \
    max-limit=88000000/88000000 total-queue=default disabled=no



这2条规则应该是相互的  30M是每台电脑最大使用的带宽值    88M为总带宽   问题带宽均分的时候是分88M还是30M

是不是一台电脑下载的时候使用的是88M的带宽 最大值不超过30M  如果3台电脑同时下载就是88/3=29M 而不是30/3=10M   留出的12M部门因为

add name="icmp-pckj" dst-address=0.0.0.0/0 interface=all parent=none \
    packet-marks=icmp priority=1 queue=default/default limit-at=0/0 \
    max-limit=0/0 total-queue=default disabled=no
add name="small-pckj" dst-address=0.0.0.0/0 interface=all parent=none \
    packet-marks=small priority=2 queue=default/default limit-at=0/0 \
    max-limit=0/0 total-queue=default disabled=no
add name="middle-pckj" dst-address=0.0.0.0/0 interface=all parent=none \
    packet-marks=middle priority=3 queue=default/default limit-at=0/0 \
    max-limit=0/0 total-queue=default disabled=no

这几条规则在

add name="PCQ-PCKJ" target-addresses=192.168.1.0/24 dst-address=0.0.0.0/0 \
    interface=all parent=none priority=8 queue=PCQ-up/PCQ-down limit-at=0/0 \
    max-limit=88000000/88000000 total-queue=default disabled=no
上面 所以小包在带宽满的情况下能使用12M带宽

这条  add name="PCQ-PCKJ" target-addresses=192.168.1.0/24 dst-address=0.0.0.0/0 \
    interface=all parent=none priority=8 queue=PCQ-up/PCQ-down limit-at=0/0 \
    max-limit=88000000/88000000 total-queue=default disabled=no

值对下面的中包和大包有效
routeros
回复

使用道具 举报

 楼主| 发表于 2010-5-15 20:34:37 | 显示全部楼层
2    他的数据包优先为什么不在  queue tree里面做 而在queue simple       做是什么意思   一般都在queue tree里面做规则啊
3  做整体限速的时候 pcq-total-limit=2000  这个地方要改不呢   网大说 一般机器的LIMIT最少要用50的话   那么总数值要50*机器数  但是我看了好多人 的TOTAL-LIMIT都是默认的2000

求高手和好心人解答
routeros
回复

使用道具 举报

发表于 2010-5-16 04:07:43 | 显示全部楼层
光纤你用20000吧,就看你信谁,50是排队的包量,你有多少个排队你自己明白,不要什么都看理论,理论来说带宽是黄道,真要学东西到官方去看看吧
http://forum.mikrotik.com/
routeros
回复

使用道具 举报

发表于 2010-5-18 00:10:10 | 显示全部楼层
routeros
回复

使用道具 举报

发表于 2010-5-18 00:10:35 | 显示全部楼层
routeros
回复

使用道具 举报

发表于 2010-5-19 15:33:40 | 显示全部楼层
一楼的标记中包含p2p数据,没有把p2p数据分离出来。
routeros
回复

使用道具 举报

发表于 2010-5-19 15:36:32 | 显示全部楼层
  1. / ip firewall mangle

  2. add chain=prerouting p2p=all-p2p action=mark-connection new-connection-mark=p2p-con passthrough=yes comment="" \

  3.     disabled=no

  4. add chain=prerouting connection-mark=p2p-con action=mark-packet new-packet-mark=p2p passthrough=yes comment="" \

  5.     disabled=no

  6. add chain=prerouting connection-mark=!p2p-con action=mark-packet new-packet-mark=general passthrough=yes comment="" \

  7.     disabled=no

  8. add chain=prerouting packet-size=0-512 action=mark-connection new-connection-mark=small-con passthrough=yes comment="" \

  9.     disabled=no

  10. add chain=prerouting packet-mark=!p2p connection-mark=small-con packet-size=0-512 action=mark-packet \

  11.     new-packet-mark=small passthrough=no comment="" disabled=no

  12. add chain=prerouting packet-size=513-1000 action=mark-connection new-connection-mark=middle-con passthrough=yes \

  13.     comment="" disabled=no

  14. add chain=prerouting packet-mark=!p2p connection-mark=middle-con packet-size=513-1000 action=mark-packet \

  15.     new-packet-mark=middle passthrough=no comment="" disabled=no

  16. add chain=prerouting packet-size=1001-1300 action=mark-connection new-connection-mark=middle-big-con passthrough=yes \

  17.     comment="" disabled=no

  18. add chain=prerouting packet-mark=!p2p connection-mark=middle-big-con packet-size=1001-1300 action=mark-packet \

  19.     new-packet-mark=middle-big passthrough=no comment="" disabled=no

  20. add chain=prerouting protocol=tcp src-port=80 action=mark-connection new-connection-mark=ie-con passthrough=yes \

  21.     comment="" disabled=no

  22. add chain=prerouting packet-mark=!p2p connection-mark=ie-con action=mark-packet new-packet-mark=ie passthrough=no \

  23.     comment="" disabled=no

  24. add chain=prerouting packet-size=1301-1500 action=mark-connection new-connection-mark=big-con passthrough=yes \

  25.     comment="" disabled=no

  26. add chain=prerouting packet-mark=!p2p connection-mark=big-con packet-size=1301-1500 action=mark-packet \

  27.     new-packet-mark=big passthrough=no comment="" disabled=no

复制代码
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-11-25 04:31 , Processed in 0.056388 second(s), 6 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表