Removing Busy Leases From Dhcp Pool - MikroTik Script RouterOS

Whenever we’re designing a network, we’re trying to assign at least one continuous block of IP addresses for an automatic client assignment. Using the DHCP server, we can make network administration much easier. We can even use the DHCP server to assign an IP address for the servers in our network.

When the DHCP server spots a previously existing IP address from its DHCP leases pool, it will block that address from further assignment. This mechanism will prevent duplicated IP addresses in the same network segment.

The problem - a lack of the free IP addresses

These IP address will be marked as busy in the leases list. In most cases, the busy address is the static IP address of some host. If we have too many DHCP clients in the network, every unavailable lease may cause a problem for everyday operations.

The best way to avoid such a situation is to periodically remove these busy leases. The easiest way to do this, is to use the scheduled script.

# Delete BUSY leases from DHCP server
# version 1.0 (15.06.2017.)
# copyright (C) 2017. Srdjan Stanisic (
# the script will erase all DHCP leases in the status - BUSY
:local busyaddr [ip dhcp-server lease find status="busy"]
:local i
:foreach i in $busyaddr do={
/ip dhcp-server lease remove $i;