Forked from ibnux/gist:59dd7d64bd9cb7e1e670b6ddd70ad991
          
        
    
          Created
          June 26, 2020 21:46 
        
      - 
      
 - 
        
Save virgiliopontes/7d5be1caea47f924e4f8bd4cfb7793b6 to your computer and use it in GitHub Desktop.  
    Mikrotik Script for DHCP Lease to Queue simple
  
        
  
    
      This file contains hidden or 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