Community discussions

MikroTik App
 
jonah1810
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 98
Joined: Tue Jul 30, 2019 10:19 pm

DHCP $lease-options?

Wed May 13, 2020 11:19 pm

Hey I Currently have

:local queueName "Client- $leaseActMAC";

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

to create static queues on dhcp leases, this works fine however I want to be able to queue different packages based off of DHCP Options (as im not using these parameters for anything else) but i can not figure out how to get the variables from an array. DHCP Option is Surfer, Streamer, Binger
here's what i've tried:

:if ($leaseBound = "1" && $lease-options[0] = "Surfer")
:if ($leaseBound = "1" && $lease-options = "0" )
:if ($leaseBound = "1" && $lease-options = [0] )

I just don't get how to define which number in an array I'm asking it to look for

any help would be greatly appreciated
 
madman22
just joined
Posts: 18
Joined: Fri Mar 23, 2018 4:28 pm

Re: DHCP $lease-options?

Tue Dec 22, 2020 1:06 am

:foreach k,i in=$"lease-options" do={
  :log info $k
  :log info $i
}
I just figured this out today, $k is the option number. Figured I'd post for future searchers.
 
ninobele
just joined
Posts: 1
Joined: Thu Mar 04, 2021 5:15 am

Re: DHCP $lease-options?

Wed Jun 23, 2021 6:22 am

Good day,
do you have any idea about

:local queueName "Client- $leaseActMAC";

how can i change the Client to comment? I want to display it in simple queue as comment-active mac

Who is online

Users browsing this forum: alexantao and 15 guests