dhcp sync in HA mode

Is there a way to synchronize dhcp leases between 2 nodes in HA (or using OSPF) ? Should I use an extra aggregation layer? Same for IPv6 how to ensure if one node crash that others keeps their IPs (or get a new one?

Ability to sync lease data between cooperating DHCP servers is entirely up to individual server implementation. Most implementations doesn’t have it and neither does DHCP service implementation in ROS.

Now, you can synchronize static leases (using some script that exports relevant configuration subtree on both servers, merges it and uploads resulting file to both), but it’s not possible to do it for dynamic leases (and I personally don’t see a point in doing it).

hrm OK, but then what should be done when a router hangs in HA mode ? Is waiting for the end of lease enough? Will the client ask for a new IP to the currently running DHCP server?

The DHCP implementation of Mikrotik is quite smart, so if you run two DHCP servers on the same L2 segment, they can work simultaneously without interfering with each other. Before leasing an address, the server checks whether the address doesn’t respond to pings, so if one of them assigns an address to a client, the other one won’t assign the same address even if they use overlapping pools. And both of them (in case of Mikrotik) lease out the address the client asks for unless it is occupied by another client, so even if the server that has leased it originally dies, once the client asks for a re-lease, the other server will accept that and lease the same address to it.

But when you want to see the list of active clients, you have to look at both servers.

Also a VRRP interface assigned to the DHCP server also work for HA…unless it fails over all client leases end up on one device (e.g. VRRP master) is the benefit.