script

my ip rang 192.168.10.0/24
and i simple queue
but this script
can someone help me
i don’t know from where i should start
thx for try

:local traf;
/queue simple
:for i from=1 to= 254 do = {
:if ([/queue simple find target-addresses=(“192.168.10.” . $i)] != “”) do={
:set traf [get [find target-addresses=(“192.168.10.” . $i)] total-bytes]
:if ($traf > 1048500) do = {
set [find target-addresses=(“192.168.10.” . $i)] max-limit=

}
}
}

i use RO 3.30
but no script run fine why??
:for i from=2 to=254 do={/queue simple add name=“172.16.64.$i”
target-address=“172.16.64.$i/32” max-limit=“256000/800000”
burst-limit=“0/1500000” burst-threshold=“0/400000” burst-time=“0s/1m”}

use PCQ and set 1 simple queue that will limit all the users in network. For examples please take a look on wiki and search in forum.

janisk thx
i had take many look :smiley:
simple i wan to know why script don’t work with me
i like to know more about script
i know about PCQ

A few things I noticed:

  1. I usually don’t put spaces between ‘do={’
  2. specify a max-limit when setting the queue.

Try this code: (replace FIXME with a max-limit value)

:local traf;
/queue simple
:for i from=1 to=254 do={
   :if ([/queue simple find target-addresses=("192.168.10." . $i)] != "") do={
      :set traf [get [find target-addresses=("192.168.10." . $i)] total-bytes]
      :if ($traf > 1048500) do = {
         set [find target-addresses=("192.168.10." . $i)] max-limit=FIXME
      }
   }
}

it come like that but no hope
any idea what could be the problem

:local traf;
/queue simple
:for i from=10 to=15 do={
:if ([/queue simple find target-addresses=(“192.168.10.” . $i)] != “”) do={
:set traf [get [find target-addresses=(“192.168.10.” . $i)] total-bytes]
:if ($traf < 1048500) do = {
set [find target-addresses=(“192.168.10.” . $i)] max-limit=16000/16000
}
}
}

Here is the corrected version (my last post wasn’t quite the correct version):

Again, (replace FIXME with a max-limit value):

:local traf;
/queue simple
:for i from=1 to=254 do={
   :if ([/queue simple find target-addresses=("192.168.10." . $i)] != "") do={
      :set traf [get [find target-addresses=("192.168.10." . $i)] total-bytes]
      :if ($traf > 1048500) do={
         set [find target-addresses=("192.168.10." . $i)] max-limit=FIXME
      }
   }
}

had you test it ??

Does the latest post work for you?

no one work with me :S

Here is the exact script I tested, and it worked on v4.8 x86:

:local traf;
/queue simple
:for i from=1 to=254 do={
   :if ([/queue simple find target-addresses=("192.168.10." . $i)] != "") do={
      :set traf [get [find target-addresses=("192.168.10." . $i)] total-bytes]
      :if ($traf > 1048500) do={
         set [find target-addresses=("192.168.10." . $i)] max-limit=16000/16000
      }
   }
}

it dont work with me
i have v3.30 do u think that will cuz tobrok this scrpit

How are you running the script and what error message do you get?

I think the problem was in the matching of the target address, it lacked the ‘/32’ suffix

/queue simple {
   :for i from=1 to=254 do={
      :local o [find target-addresses=("192.168.10." . $i . "/32")]
      :if ($o != "") do={
         :if ([get $o total-bytes] > 1048500) do={
            set $o max-limit=16000/16000
         }
      }
   }
}

13 post
274 viwe
thx for every one
but psamsig u get karam + thx