I’d like to manage my DHCP static leases outside of the router. (I’ll likely be using a simple text file, containing hostname, IP address, and MAC, but how I store my list doesn’t really matter.)
I can easily turn that list into the “/ip dhcp-server lease add …” commands needed to load them into the server. But if I retire a host, and remove it from my text file, it won’t (easily) be removed from the router by my script. Similarly, if I want to give a host a new address, simply reimporting will result in two leases for that host.
The obvious clean solution would be to simply clear all static leases, and then add them back again.
Is there a way to clear all static leases using the MikroTik console?
No options for finding only static ones or I might be missing something you could use to target just them, seems weird to not have something like that.
Thanks. I certainly wouldn’t want to remove the dynamic ones. I can probably cobble something together, by printing the leases and writing a script to find the ones not marked dynamic. But it’ll be ugly, I can promise you that.
I suppose anyone that wants to manage addresses off-router uses a radius server. I wish there were something in between that and having to use the CLI, though, like maybe reading static lease information from a file. The other alternative is running a separate DHCP server.