Autonomous Queue Creation For DHCP Server Leases

Creating speed limits for devices is a common practice for Mikrotik users. This can be a very time-consuming task when you are dealing with multiple DHCP servers and massive subnets. We have created a Script run in 2-minute intervals to check for new and expired DHCP leases and generate a queue for each DHCP Server Lease present on your RouterOS device.

/system scheduler
add interval=2m name=”Qeueu Leases” on-event=”/ip dhcp-server lease {\r\
\n :foreach i in=[find] do={\r\
\n :local leasedIp [get \$i address]\r\
\n /queue simple {\r\
\n :if ([:len [find target=(\”\$leasedIp/32\”)]] = 0) do={\r\
\n add name=\$leasedIp target=\$leasedIp queue=default/defaul\
t max-limit=3M/6M \r\
\n }\r\
\n }\r\
\n }\r\
\n}\r\
\n/queue simple {\r\
\n :if (\$leaseBound = \”1\”) do={\r\
\n\t add name=\$leaseActIP target=\$leasedIp queue=default/default max-li\
mit=3M/6M \r\
\n } else={\r\
\n remove [find name=\$leaseActIP]\r\
\n }\r\
\n}” policy=\
ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon \
start-time=startup

2 replies
  1. Royal CBD
    Royal CBD says:

    Hi there! This article couldn’t be written any better!
    Looking at this article reminds me of my previous roommate!
    He continually kept talking about this. I am going to
    send this information to him. Fairly certain he’ll have a good
    read. Thanks for sharing!

    Also visit my website – Royal CBD

    Reply
  2. lining
    lining says:

    My partner and I ѕtumbled over here by a dіfferent web page and thouցht I might as
    well check tһings out. I like what I sеe so i am just following you.
    Lߋоk foгward to looking over your web page repeatedly.

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *