combine two dhcpd.leases files together
gregs at sloop.net
Tue Dec 19 01:37:52 UTC 2017
If I move a subnet from dhcpd server A to dhcpd server B, and this subnet is a dynamic subnet. What will happen to the IPs?
I guess it will have some duplicated ip occurred, right? Because of dhcpd.leases file is different?
If any possible to to combine two dhcpd.leases file together? More if possible to only add one subnet’ entries of dhcpd.leases to another server?
Any comments will be appreciated
Thanks in advance
Does the subnet you are moving from A to B already exist on B?
If it doesn't, then I *think* you could add/move the info in the leases file from A to B, add the subnet def and simply hup/restart dhcpd on B. [And obviously stop A before you grab A's leases file. Make SURE it doesn't come back after you move to B.]
If it DOES exist, then you will have to do some maneuvering to keep the problems as minimal as possible. I'd start with [provided your DHCP server can handle the additional load] shortening the lease times for the subnet you're moving/merging. Shorten it as short as you can, while still being able to do steps 1-4 below in less than half the lease time selected.
You, could block out the ranges of IP's [allowed only certain IP's in the range] that are exclusive to A and B. Then, when you merge, there will be no "shared" addresses - in that Server A won't have assigned any clients to the IP's used by Server B and vice-versa.
Then, when you move;
1) Stop dhcpd for A and B.
2) merge the leases file of A into B
3) modify the scope of the subnet on B to allow assignment in the combined range of A & B,
4) Start dhcpd on B
5) then make sure B is available to all clients, and that A is NOT available to ANY.
[As noted above; Make sure you can do these steps in substantially less time than half the lease time. That should generally ensure that no clients' dhcp lease will expire while you are merging the two servers.]
Then Server B should know what assignments to renew for each client, double-assignment shouldn't happen, and any problems can go away quickly, since the lease is short.
I *think* this works, but someone better than I should check my work. :)
I should note, that I've never tried to do this myself - merging two different leases files - but I'm not aware of any reason it's not possible.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the dhcp-users