[ASK] DHCP Server Script for Queue

Hi all, thanks for coming.

I have RouterOS 6.42.6 x86. I’m managing a network with open access (everyone can connect to it). Any client that are connected to my network get IP from DHCP server and allocated 1Mbps on upload/download (using queue tree HTB).

It’s very inefficient if I put every single mangle and queue for whole IP address (/24). So I decide to use script. I found an interesting article about DHCP Server https://wiki.mikrotik.com/wiki/Manual:IP/DHCP_Server#DHCP_Options.

The idea is, if user get an IP from dhcp server, the script for assigning IP will be triggered (triggered by $leaseBound = “1”) and makes mangle & queue then comment them with IP address (with variable $leaseActIP). So far, it works for creating mangle and queue. But when user deassign IP address, $leaseActIP get blank and fail to remove queue and mangle.

I just want to ask, is there any built-in variable that indicate deassigned user’s IP. So I can remove queue and mangle. Or maybe, you have another workaround for my problem.

I appreciate every comment
Thanks

http://forum.mikrotik.com/t/yet-another-dhcp-to-dns-script/107005/1 uses $leaseActIP for cleanup and is working fine. Are you sure that $leaseActIP is empty on deassign?

nice one:)

Thanks a lot. It solve the problem.
I did some debug last night with :log info.
And got $leaseActIP didn’t blank anymore. Maybe because I used local variable to store the IP.

Can you shar the script

Do not necropost, the unser is not longer online and the last post is on 2018…