Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save khairulhasanmd/6fc7691db878d615d63dcbf00e0973c0 to your computer and use it in GitHub Desktop.
Save khairulhasanmd/6fc7691db878d615d63dcbf00e0973c0 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];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment