RouterOS Script to Find iPhones

Created by Faye Admin, Modified on Thu, May 29 at 11:11 AM by Faye Admin

This script will find devices in the DHCP Server leases list with a string in the device name. The purpose is to find iPhones so we can rate limit their upload, so as to not consume all our uplink bandwidth on slow connections by putting them on an address list. Feel free to use or customize.

      /system script add name=script1 owner=admin policy=\ ftp,reboot,read,write,policy,test,password,sniff,sensitive source="/ip firew\ all address-list remove [find comment=\"dynamic iPhone catcher\" ]\r\ \n\r\ \n:foreach i in=[/ip dhcp-server lease find host-name~\"iPhone\"] do={\r\ \n/ip firewall address-list add address=[/ip dhcp-server lease get \$i addre\ ss] list=iPhones timeout=[/ip dhcp-server lease get \$i expires-after ] comm\ ent=\"dynamic iPhone catcher\" \r\ \n}\r\ \n\r\ \n:foreach i in=[/ip dhcp-server lease find host-name~\"iPad\"] do={\r\ \n/ip firewall address-list add address=[/ip dhcp-server lease get \$i addre\ ss] list=iPhones timeout=[/ip dhcp-server lease get \$i expires-after ] comm\ ent=\"dynamic iPhone catcher\" \r\ \n}"

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article