Limit user/IP by volume

I want to limit queue IP when he reaching 1Gb
DHCP Pool Range 192.168.8.10-192.168.8.20

Using Router OS 6
Get Syntax error when running script try to add $ variable then syntax error goes away but limit does not apply to target.

:local traffic
/queue simple
:for i from=1 to=254 do={
:set traffic [get [find target-addresses=“192.168.8.$i/32”] total-bytes]
:if ($traffic > 1000000000) do={
set [find target-addresses=“192.168.8.$i/32”] max-limit=128000/128000
}
}

Where is “total-bytes” coming from? The router does not register or hold this information unless using hotspot.

Not 100% true, you do get traffic data by IP using snapshot, bit as far as I know, it can not be used to bandwidth limeting.
I may be possible to write a script that take snapshot every minute, then add all bytes for an IP.
Can be bypassed by changing IP, and how to administrate this etc…
This is just an idea. :slight_smile: