I stuck here:
I have part of good output for the appropriate mac
Code: Select all
ip dhcp-server lease print where mac-address~"^AA:BB:CC"
Flags: X - disabled, I - invalid, H - DHCP, D - dynamic, P - published, C - complete
# ADDRESS MAC-ADDRESS INTERFACE
0 DC 10.11.138.130 AA:BB:CC:D7:08:35 lan_bridge
1 DC 10.11.138.131 AA:BB:CC:08:19:BF lan_bridge
Code: Select all
:local queueName "Client-$leaseActMAC";
:local ipAdd "$leaseActIP/32";
:if ([:len [/queue simple find name=$queueName]] = 0) do={
:log info "No Queue";
/queue simple add name=$queueName target=($ipAdd) limit-at=10M/4M max-limit=10M/4M comment=[/ip dhcp-server lease get [find where active-mac-address=$leaseActMAC && active-address=$leaseActIP] host-name];
} else={
:log info "exists";
:local ada [/queue simple get [find name=$queueName] target];
:log info "existing $ada";
:if ($ada = $ipAdd) do={
:log info "IP same $ada";
} else={
/queue simple set target=($ipAdd) [find name=$queueName];
}
}
How can I use it only for IP which mac starts with AA:BB:CC