Finding an AVAILABLE IP from a subnet managed by MaaS

Hi Team,

Is there a CLI or API that would provide me an AVAILABLE IP from a subnet managed by MaaS? The plan is to obtain a free IP and the assign it as a Static/Sticky IP for a machine, so that the machine gets same IP every time it is deployed.

For IPv6, its straight forward to generate an IP in EUI-64 format and assign it to the machine. I am looking for options for IPv4.

We run MaaS 3.5 setup using apt packages.

thanks!

There is no such command. If you want to assign static IPs you should have a clear inventory of your DC and reflect it into MAAS.

Once you set a static IP to the machine, there is no need to re-assign it. When the machine is released the static IPs are not cleaned up

Thanks for the suggestion.

I have a setup that has a handfull of deployed nodes. They were setup with AUTO mode for IPs. I would like to change the way IP address is associated with a machine to Static and gradually replace the deployed machines IP address strategy to Static. And so, I am looking for a safe way to find an Available IP from the pool to reduce the risk of IP duplication. Is there any recommendation on how this can be achieved? May be I will have to mimic MaaS way of finding an IP and build a custom code.

When the machine is released the static IPs are not cleaned up

How about Machine deletion from MaaS Inventory? I am guessing the IP will be then surrendered and available for use by other machines.

thanks!

MAAS tries to ping the IP on the network before assigning it. If there is a machine on the network with such IP, MAAS will discover it and will avoid using it