Skip to content

Instantly share code, notes, and snippets.

@ibnux
Last active September 20, 2024 20:14
Show Gist options
  • Save ibnux/59dd7d64bd9cb7e1e670b6ddd70ad991 to your computer and use it in GitHub Desktop.
Save ibnux/59dd7d64bd9cb7e1e670b6ddd70ad991 to your computer and use it in GitHub Desktop.
Mikrotik Script for DHCP Lease to Queue simple
: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];
}
}
@ibnux
Copy link
Author

ibnux commented Aug 18, 2019

put this at IP -> DHCP Server
click any server
tab Script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment