Page 1 of 1

IP exclusion in script

Posted: Fri Nov 01, 2019 4:44 pm
by SapieH
I am using the following script to control individual devices in a coffee shop (free Wi-Fi). I have to exclude certain devices from being affected by this script. How do I go about doing this?


:local queueName "Client- $leaseActMAC";

:if ($leaseBound = "1") do={
/queue simple add name=$queueName target=($leaseActIP . "/32") parent="Internal" max-limit=1000k/1000k comment=[/ip dhcp-server lease get [find where active-mac-address=$leaseActMAC && active-address=$leaseActIP] host-name];
} else={
/queue simple remove $queueName
}

Re: IP exclusion in script

Posted: Fri Nov 01, 2019 10:30 pm
by tomaskir
Your post is rather vague on the details, but something like this should do:
/ip dhcp-server lease
:foreach i in=[find dynamic] do={
  :local mac [get $i active-mac-address]
  :local ip [get $i active-address]
  :local host [get $i host-name]

  /queue simple
  add name=("Client-" . $mac) target=($ip . "/32") parent="Internal" max-limit=1000k/1000k comment=$host
}

Re: IP exclusion in script

Posted: Sat Nov 02, 2019 9:44 am
by SapieH
Thanks for that. Much appreciated.