Mikrotik Shaper – DHCP Queues

: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/10M max-limit=10M/10M 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];
        }
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.