IP Pool and DHCP Management on MikroTik
Effective DHCP management keeps your network running smoothly. This post covers routine DHCP administration tasks: managing pools, cleaning stale leases, tracking clients, and handling IP conflicts.
Reviewing Pool Utilization
/ip pool used print
/ip pool printCompare used against the pool's range to gauge utilization. A pool nearing exhaustion means some clients will fail to get IPs.
Listing All Active Leases
/ip dhcp-server lease printAdd status filters:
/ip dhcp-server lease print where status=bound # active leases
/ip dhcp-server lease print where status=waiting # expiring/pendingClearing Stale Leases
Old devices leave stale leases in your table. Manual cleanup:
/ip dhcp-server lease remove [find status=waiting]
/ip dhcp-server lease remove [find last-seen>1d]Or adjust lease time so stale entries expire faster:
/ip dhcp-server network set [find] lease-time=12hConverting a Dynamic Lease to Static
When a device should always get the same IP:
/ip dhcp-server lease make-static [find address=192.168.10.55]This locks that device's MAC to that IP. Alternatively, add manually:
/ip dhcp-server lease add address=192.168.10.55 mac-address=AA:BB:CC:DD:EE:FF server=dhcp1Searching for a Device by MAC
/ip dhcp-server lease print where mac-address="AA:BB:CC:DD:EE:FF"Useful when a user reports connectivity problems — find their IP from MAC address.
Finding Duplicate IPs
IP conflicts cause mysterious connectivity problems. Use ARP to find duplicates:
/ip arp printIf two MACs share the same IP, you have a conflict. Check for rogue DHCP servers or static IP assignments overlapping with the pool.
Expanding the Pool When Running Low
/ip pool set dhcp_pool ranges=192.168.10.10-192.168.10.250Or add a second pool range:
/ip pool add name=dhcp_pool2 ranges=192.168.20.10-192.168.20.200
/ip dhcp-server set dhcp1 address-pool=dhcp_pool,dhcp_pool2DHCP Lease Notification Script
Get notified when a new device joins:
/system script add name=new-lease-alert source={
:local mac [/ip dhcp-server lease get [find where dynamic=yes] mac-address]
/tool e-mail send to=admin@example.com subject=("New device: " . $mac) body=($mac . " got IP")
}
/ip dhcp-server set dhcp1 lease-script=new-lease-alertBlocking Specific Devices from DHCP
Add a static lease with an IP outside your pool to effectively block a MAC from getting an IP:
/ip dhcp-server lease add mac-address=BA:D0:FF:EN:DE:D0 address=192.168.10.254 server=dhcp1 comment=blockedOr use the /ip dhcp-server lease make-permanent approach and then add a firewall rule blocking that IP.
Clean DHCP management prevents mysterious "no internet" calls and IP conflict incidents. Make lease table review part of your monthly maintenance routine.
