Last active
September 20, 2024 20:14
-
-
Save ibnux/59dd7d64bd9cb7e1e670b6ddd70ad991 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
put this at IP -> DHCP Server
click any server
tab Script