Lease Script - Bandwidth control with IP range

Hello
I’m already a few hours searching this forum and have not yet found what I’m in need.
on my network I have two RBD52G with Capsman controlling wi-fi.
I need my family and visitors’ devices to have a band control so they don’t interfere with my home office work.

The best configuration I have found so far for my network is a single DHCP for wi-fi and wired network, thus avoiding problems with network printers, chromecast, etc…

searching the internet I found an interesting solution, the lease script below:


if ($leaseBound=1) do={
/queue simple add max-limit=100k/512k target=$leaseActIP comment=$leaseActMAC
} else={
/queue simple remove [find comment=$leaseActMAC]
}

At first I thought the script would only affect connections where DHCP delivered an IP…
and that would not affect devices marked with fixed IP in DHCP (tied via MAC).

But I realized that he started limiting the bandwidth of all devices, including those of fixed IP that should not have limitation.

need a way that this script has the target a specific ip range of the DHCP example
192.168.1.20-192.168.1.254

Could someone help me?

Hi,
This is the script i have been running so far and its working..
just modify the IP as your ip 192.168.1.20

:local queueName "$leaseActIP";
:if (($leaseBound=1) && ($leaseActIP>"192.168.20.7")) do {
    /queue simple add name=$queueName target=($leaseActIP . "/32") max-limit=2M/5M comment=[/ip dhcp-server lease get [find where active-mac-address=$leaseActMAC && active-address=$leaseActIP] host-name];
}
:if (($leaseBound=0) && ($leaseActIP>"192.168.20.7")) do {
    /queue simple remove $queueName
}