MAAS: How to release old dhcp leases

Hello,

I’m facing a problem while deploying a server in MAAS. The error shows as “No more IPs available in subnet:”

I checked the subnet and some of the IPs are not being used anymore. How do I release those leases?

For example, i have this hostname1 with two DHCP IPs, one is old and the other is new. I want to remove the old which is not pinging anymore.

thanks,
Jewsco

Can you run

sudo -u postgres psql -d maasdb -c "
SELECT count(*)
from maasserver_staticipaddress
left join maasserver_interface_ip_addresses on maasserver_staticipaddress.id = maasserver_interface_ip_addresses.staticipaddress_id
left join maasserver_interface on maasserver_interface.id = maasserver_interface_ip_addresses.interface_id
where maasserver_staticipaddress.ip is NULL and maasserver_interface.type = 'unknown' and maasserver_staticipaddress.alloc_type = 6;
"

?

@r00ta , thanks for responding, here it is.

$ psql -d maasdb -c "SELECT count(*)

from maasserver_staticipaddress
left join maasserver_interface_ip_addresses on maasserver_staticipaddress.id = maasserver_interface_ip_addresses.staticipaddress_id
left join maasserver_interface on maasserver_interface.id = maasserver_interface_ip_addresses.interface_id
where maasserver_staticipaddress.ip is NULL and maasserver_interface.type = ‘unknown’ and maasserver_staticipaddress.alloc_type = 6;
"
count


 2

(1 row)

Looks like you have only 2 orphans? BTW !Action required: this cleanup might speedup your MAAS (3.4.0 and below) environments

Thanks @r00ta

So i got a subnet allocated(172.21.68.64/27) and a maas owned dynamic range(172.21.68.71 - 172.21.68.94) which would yield 24 IPs and the Used IP addresses is only showing 11. One of the IP is pingable(172.21.68.76) and the rest are not. SO i’m wondering why i get this “No more IPs available in subnet” error.

You might be facing Bug #2050200 “IP exhaustion during deployment of machine” : Bugs : MAAS .

In short, try to clean the neighbours in the UI and check if you have IPs available

Thanks for the update.

Do you mean clean the neighbors/discovered through the UI? I’m not able to find a button in the UI to do that.

Do you mean clean the ARP table in the Rack server using arp -d? I only see two entries there, the eth1 is the dhcp facing interface.
root@lxmasracknpes03:~# arp -a |grep eth1
? (172.21.68.79) at c4:cb:e1:ab:17:31 [ether] on eth1
lxmasracknpes04-pxe.example.com (172.21.68.68) at 00:50:56:a8:f7:62 [ether] on eth1
? (172.21.68.69) at c4:cb:e1:ab:17:30 [ether] on eth1
root@lxmasracknpes03:~#

btw, i’m only having IP exhaustion at the “Deploy” action, inlisting/commissioning shows no issue.

You can maas admin discoveries clear with the CLI

$ maas admin discoveries clear all=True -k
Success.
Machine-readable output follows:

$ maas admin discoveries read -k
Success.
Machine-readable output follows:
[]
$

Run the deploy again and still got the same error - No more IPs available in subnet: 172.21.68.64/27

After you try to deploy what’s the response from maas admin discoveries read (without cleaning them again)?