Community discussions

MikroTik App
 
benoitc
Member Candidate
Member Candidate
Topic Author
Posts: 169
Joined: Wed Jul 08, 2020 12:33 am

dhcp sync in HA mode

Sun Jan 08, 2023 1:45 pm

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?
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 11433
Joined: Thu Mar 03, 2016 10:23 pm

Re: dhcp sync in HA mode

Sun Jan 08, 2023 2:15 pm

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).
 
benoitc
Member Candidate
Member Candidate
Topic Author
Posts: 169
Joined: Wed Jul 08, 2020 12:33 am

Re: dhcp sync in HA mode

Sun Jan 08, 2023 2:39 pm

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?
 
sindy
Forum Guru
Forum Guru
Posts: 10205
Joined: Mon Dec 04, 2017 9:19 pm

Re: dhcp sync in HA mode

Sun Jan 08, 2023 4:26 pm

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.
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3250
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: dhcp sync in HA mode

Sun Jan 08, 2023 10:49 pm

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.

Who is online

Users browsing this forum: Amazon [Bot], FoxWhite, GoogleOther [Bot], onnyloh and 48 guests