Community discussions

MikroTik App
 
blackhiden
just joined
Topic Author
Posts: 8
Joined: Wed Aug 30, 2017 2:50 pm

[ASK] DHCP Server Script for Queue

Wed Aug 01, 2018 7:01 pm

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:I ... CP_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
 
nescafe2002
Forum Veteran
Forum Veteran
Posts: 897
Joined: Tue Aug 11, 2015 12:46 pm
Location: Netherlands

Re: [ASK] DHCP Server Script for Queue  [SOLVED]

Wed Aug 01, 2018 10:25 pm

viewtopic.php?t=119469 uses $leaseActIP for cleanup and is working fine. Are you sure that $leaseActIP is empty on deassign?
 
User avatar
nichky
Forum Guru
Forum Guru
Posts: 1281
Joined: Tue Jun 23, 2015 2:35 pm

Re: [ASK] DHCP Server Script for Queue

Wed Aug 01, 2018 11:00 pm

viewtopic.php?t=119469 uses $leaseActIP for cleanup and is working fine. Are you sure that $leaseActIP is empty on deassign?

nice one:)
 
blackhiden
just joined
Topic Author
Posts: 8
Joined: Wed Aug 30, 2017 2:50 pm

Re: [ASK] DHCP Server Script for Queue

Fri Aug 03, 2018 4:16 pm

viewtopic.php?t=119469 uses $leaseActIP for cleanup and is working fine. Are you sure that $leaseActIP is empty on deassign?


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.
 
haedertowfeq
just joined
Posts: 15
Joined: Thu Nov 19, 2020 5:58 pm

Re: [ASK] DHCP Server Script for Queue

Wed Aug 30, 2023 9:41 pm

Can you shar the script
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12014
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: [ASK] DHCP Server Script for Queue

Thu Aug 31, 2023 2:17 pm

Can you shar the script
Do not necropost, the unser is not longer online and the last post is on 2018....

Who is online

Users browsing this forum: caldo85 and 9 guests