caption11 发表于 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

caption11 发表于 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

值对下面的中包和大包有效

caption11 发表于 2010-5-15 20:34:37

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

求高手和好心人解答

WGHBOY 发表于 2010-5-16 04:07:43

光纤你用20000吧,就看你信谁,50是排队的包量,你有多少个排队你自己明白,不要什么都看理论,理论来说带宽是黄道,真要学东西到官方去看看吧
http://forum.mikrotik.com/

lgd325 发表于 2010-5-18 00:10:10

:)

lgd325 发表于 2010-5-18 00:10:35

:)

g1325 发表于 2010-5-19 15:33:40

一楼的标记中包含p2p数据,没有把p2p数据分离出来。

g1325 发表于 2010-5-19 15:36:32

/ ip firewall mangle

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

    disabled=no

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

    disabled=no

add chain=prerouting connection-mark=!p2p-con action=mark-packet new-packet-mark=general 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 packet-mark=!p2p connection-mark=small-con packet-size=0-512 action=mark-packet \

    new-packet-mark=small passthrough=no 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 packet-mark=!p2p connection-mark=middle-con packet-size=513-1000 action=mark-packet \

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

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

    comment="" disabled=no

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

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

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

    comment="" disabled=no

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

    comment="" disabled=no

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

    comment="" disabled=no

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

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

页: [1]
查看完整版本: 各位老大 麻烦进来看看这个脚本