I think tools from contrib/lease-tools might help you with that. It makes dnsmasq to release some lease on demand. If you shut down VM, it can be used to free its former lease.
I think also d-bus API can be used for the same thing, it might be more reliable. On 2/11/19 9:43 PM, Graeme Peterson wrote: > Hi all. Happy 2019! > > A bit of an odd question: Is there any way to run dnsmasq in some kind > of standalone test or dry-run mode without being connected to > actual/virtual networks, where I could define subnets and IP ranges, > somehow issue requests for IPs on subnets, and then use those IPs in my > VM deployment tests that require static IPs, releasing them when done or > when their lease expires? > > EXPLANATION > =========== > > I work in a test team on a product that does a lot of virtual network > configuration for various deployed VMs. Some of the testing uses dhcp > for the VMs' interfaces, so far so good. Some tests need to exercise > static IP configuration. I need a way to manage the allocation of static > IPs on all the test VMs in our automation. Hard coding the values is > cumbersome, error prone, and we run out of IPs in most /24 subnets > pretty quickly if we make sure every test deployment has a unique static > IP. > > So I got to thinking. I could write some kind of static IP allocator > that would respond to requests on a per-subnet basis, release the IPs > back into a pool of some kind when the test is done with them, maybe > have a timeout to auto-release the IPs in case the release is missed,... > > > Hang on. Sounds like dhcp. Which brings me to my above question, and > this email. > > Thank you, > Graeme > > > _______________________________________________ > Dnsmasq-discuss mailing list > Dnsmasqemail@example.com > http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss > -- Petr Menšík Software Engineer Red Hat, http://www.redhat.com/ email: pemen...@redhat.com PGP: 65C6C973 _______________________________________________ Dnsmasq-discuss mailing list Dnsmasqfirstname.lastname@example.org http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss