Community discussions

MikroTik App
 
jonah1810
newbie
Topic Author
Posts: 29
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: 16
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.

Who is online

Users browsing this forum: No registered users and 32 guests