全场-单机单流-限速与全场-设开关控整体均流-限速--转自网络

运行环境是:网吧是凌晨2电信调整光纤上传与下载带宽为4M,下午18点电信会调整光纤上传与下载带宽为10M


先添加的单机单流限速,再设置整体均流限速,加设流量开关,当全场带宽快用尽了就会启用整体均流限速,把全场的每台机流量再抑制一个级别,这样带宽就能充份利用,而不会造成因带宽不足造成“卡”的情况!

一.批量打简单限制:
1.批量添加限速脚本
全场2-230号机绑定:---------意解为:设当aixin范围是to值,执行do{内容=(空格.空格$aixin)}命令

:for aixin from=2 to 230 do=[/queue simple add name=(RH . $aixin) dst-address=(192.168.0. . $aixin) max-limit=800000/256000 interface=wai]



二.限制一个网段用PCQ------标记所有数据包,跟标记全场均流上传与下载的流量:
1..标记所有数据包
/ip firewall mangle add chain=prerouting action=mark-packet new-packet-mark=all passthrough=no


2.创建两条PCQ类型,全场机器下载256K和上传600K
/queue type add name="PCQ_download" kind=pcq pcq-rate=600000 pcq-classifier=dst-address
/queue type add name="
PCQ_upload" kind=pcq pcq-rate=256000 pcq-classifier=src-address


3.添加PCQ规则,下载和上传:


/queue tree add name= down-in
parent=global-in queue=PCQ_download packet-mark=all
/queue tree add name=up-out parent=global-out queue=PCQ_upload packet-mark=all


三.添加流量监控开关与添加相应被控脚本。
1.在下载带宽使用低于2.5M时关闭,高于3.8M时开启流量控制:

/tool traffic-monitor
add color=#00ccff>pcq-in-dis
interface=wai on-event= pcq-in-dis threshold=2560000 trigger=above traffic=received


add color=#00ccff>pcq-in-en interface=wai on-event= pcq-in-en threshold=3891200 trigger=above traffic=received



添加脚本:


/system script add name=" pcq-in-dis " source="/queue tree disable down-in " owner="admin" policy=reboot,read,write,policy,test


/system script add name=" pcq-in-en " source="/queue tree enable down-in " owner="admin" policy=reboot,read,write,policy,test

2.在上传带宽使用低于2.5M时关闭,高于3.8M时开启流量控制:


/tool traffic-monitor
add color=#ff6600>pcq-out-dis
interface=wai on-event= pcq-out-dis threshold=2560000 trigger=below traffic=received


add color=#ff6600>pcq-out-en interface=wai on-event= pcq-out-en threshold=3891200 trigger=below traffic=received



添加脚本:


/system script add name=" pcq-out-dis" source="/queue tree disable up-out " owner="admin" policy=reboot,read,write,policy,test


/system script add name=" pcq-out-en " source="/queue tree enable up-out " owner="admin" policy=reboot,read,write,policy,test



如果不用防火墙mangle标记,可以跳过mangle直接使用简单限速,也能达到全体均流限速功能
/queue type add name="PCQ_download" kind=pcq pcq-rate=600000 pcq-classifier=dst-address
/queue type add name="PCQ_upload" kind=pcq pcq-rate=256000 pcq-classifier=src-address


四.添加定时运行开关,定时修改不同时段的流量开关值。


运行环境:网吧是凌晨2点光纤自动转上传与下载带宽为4M,下午18点光纤自动转上传与下载带宽为10M



Part-1


凌晨02:00:00 更改开启下载上限监控流量值为3.8M


/system scheduler


add start-time=02:00:00 start-date=Sep/22/2000 interval=1d comment="02open" disabled=no on-event="/tool traffic-monitor set \[/tool traffic-monitor find name="pcq-in-en"\] threshold=3891200"



凌晨02:00:00 更改关闭下载上限监控流量值为2.5M


/system scheduler


add start-time=02:00:00 start-date=Sep/22/2000 interval=1d comment="02close" disabled=no on-event="/tool traffic-monitor set \[/tool traffic-monitor find name="pcq-in-dis"\] threshold=2560000"



凌晨02:00:00 更改开启上传上限监控流量值为3.8M


/system scheduler


add start-time=02:00:00 start-date=Sep/22/2000 interval=1d comment="02downopen" disabled=no on-event="/tool traffic-monitor set \[/tool traffic-monitor find name="pcq-out-en"\] threshold=3891200"



凌晨02:00:00 更改关闭上传上限监控流量值为2.5M


/system scheduler


add start-time=02:00:00 start-date=Sep/22/2000 interval=1d comment="02downclose" disabled=no on-event="/tool traffic-monitor set \[/tool traffic-monitor find name="pcq-out-dis"\] threshold=2560000"



Part-2


凌晨18:00:00 更改开启下载上限监控流量值为9M


/system scheduler


add start-time=17:30:00 start-date=Sep/22/2000 interval=1d comment="18open" disabled=no on-event="/tool traffic-monitor set \[/tool traffic-monitor find name="pcq-in-en"\] threshold=9216000"



凌晨18:00:00 更改关闭下载上限监控流量值为6M


/system scheduler


add start-time=17:30:00 start-date=Sep/22/2000 interval=1d comment="18close" disabled=no on-event="/tool traffic-monitor set \[/tool traffic-monitor find name="pcq-in-dis"\] threshold=6144000"



凌晨18:00:00 更改开启上传上限监控流量值为9M


/system scheduler


add start-time=17:30:00 start-date=Sep/22/2000 interval=1d comment="18downopen" disabled=no on-event="/tool traffic-monitor set \[/tool traffic-monitor find name="pcq-out-en"\] threshold=9216000"



凌晨18:00:00 更改关闭上传上限监控流量值为6M


/system scheduler


add start-time=17:30:00 start-date=Sep/22/2000 interval=1d comment="18downclose" disabled=no on-event="/tool traffic-monitor set \[/tool traffic-monitor find name="pcq-out-dis"\] threshold=6144000"



郑重声明:资讯 【全场-单机单流-限速与全场-设开关控整体均流-限速--转自网络】由 发布,版权归原作者及其所在单位,其原创性以及文中陈述文字和内容未经(企业库qiyeku.com)证实,请读者仅作参考,并请自行核实相关内容。若本文有侵犯到您的版权, 请你提供相关证明及申请并与我们联系(qiyeku # qq.com)或【在线投诉】,我们审核后将会尽快处理。
—— 相关资讯 ——