I’m trying to make this script working:
http://wiki.mikrotik.com/wiki/Limiting_a_user_to_a_given_amount_of_traffic_II
In a few words I want to slow down users after they download/upload a given amount of data.
Script is executed but does nothing.
I changed few things to update code for new RouterOS version and to fit my network addresses.
This is the script:
system script print
Flags: I - invalid
0 name="traffic_amount_limit" owner="admin" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive last-started=jun/30/2015 19:47:58 run-count=3
source=
:local traf;
/queue simple
:for i from=192 to=206 do={ :if ([/queue simple find target=("192.168.4." . $i . "/24")] != "") do={ :set $traf [get [find target=("192.168.4." . $i . "/24")] bytes] :if ($traf > 20971520) do={ set [find target=("192.168.4." . $i . "/24")] max-limit= 32000/64000
}
}
}
My routerOS version is 6.28
Simple queues:
0 name="device1" target=192.168.4.0/24 parent=none
packet-marks=device1_pck_mark priority=8/8
queue=default-small/default-small limit-at=0/0 max-limit=256k/2M
burst-limit=0/0 burst-threshold=0/0 burst-time=0s/0s
1 name="device2" target=192.168.4.0/24 parent=none
packet-marks=device2_pck_mark priority=8/8