combine two dhcpd.leases files together

Julie Xu J.Xu at westernsydney.edu.au
Tue Dec 19 01:54:48 UTC 2017


Thanks Greg.

From: Gregory Sloop [mailto:gregs at sloop.net]
Sent: Tuesday, 19 December 2017 12:51 PM
To: Users of ISC DHCP <dhcp-users at lists.isc.org>; Julie Xu <J.Xu at westernsydney.edu.au>
Subject: Re: combine two dhcpd.leases files together








Hi,

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

Julie




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.

-Greg



An addendum:
I did a search, and a post from Simon H [From nearly 15 years ago! Dang man, you're the wise old wizard!] seems to indicate this does work - with one priviso - the leases files must be the same format. This is going to be the case as long as A & B are running the same version of DHCPd. If not, you need to make sure they use the same format.

See: https://marc.info/?l=dhcp-server&m=102259890617062&w=2


I did
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/dhcp-users/attachments/20171219/cf05cf74/attachment-0001.html>


More information about the dhcp-users mailing list