Forked from ibnux/gist:59dd7d64bd9cb7e1e670b6ddd70ad991
Created
June 16, 2022 20:28
-
-
Save M43R/d9c05045181c7aef7fb79abde317987a to your computer and use it in GitHub Desktop.
Mikrotik Script for DHCP Lease to Queue simple
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
: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]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment