Ask Your Question

What happens when the dhcp range for Neutron reaches the end? [closed]

asked 2016-09-20 09:22:09 -0500

Campos gravatar image

We have here in our datacenter an Openstack infrastructure with a subnet pool allocation range of 510 hosts (/23). Neutron DHCP is giving out IPs to the instances, but it is almost reaching the limit of the allocation pool. There are maybe 100 more IPs to give. That of course, doesn't mean that there are 410 instances on my cloud (there are about 60). Every time I delete an instance, that IP doesn't get reallocated. So I have two questions:

  • Is there a way to "reset" the Neutron DHCP so that it can utilize those unallocated IPs?
  • What happens when the dhcp range reaches the end? Does it go back to the beginning and starts using the unallocated IPs? Or it stops giving out IPs completely, even though there are a lot of available IPs?

Appreciate all the help :)

PS: I'm using a single network for all my instances. Also, my Openstack version is Kilo.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Campos
close date 2016-09-20 12:40:40.810493

2 answers

Sort by ยป oldest newest most voted

answered 2016-09-20 12:06:50 -0500

fifi gravatar image

updated 2016-09-20 12:14:46 -0500

It works on a circular basis. If an IP has been allocated and then de-allocated, DHCP can use it later. Just you make sure the instance or its associated port has been deleted. When DHCP reaches the end of the pool and there is something available at the beginning of the pool, the DHCP will automatically use it. However, if all the IPs in the range has been allocated and nothing is available to be used, creating another instance in that specific subnet will raise an error. You will face with this error :

Error: Failed to launch instance "vm_test": Please try again later [Error: No valid host was found. ].

To avoid this you have two solution:

1- Before creating your DHCP pool, you as an admin, should try to have an estimate of number of required IPs as accurate as possible. You can also edit your DHCP range later if your subnet IP range is large enough.

2- Set a reasonable DHCP_LEASE_DURATION. Just Be aware of two tricky points in setting your desired dhcp_lease_ duration.

The dhcp_lease_duration configuration option specifies the duration of an IP address lease by an instance. The default value is 86400 seconds, or 24 hours. If the value is set too low, the network may be flooded with broadcast traffic due to short leases and frequent renewal attempts. The DHCP client on the instance itself is responsible for renewing the lease, and this operation varies between operating systems. It is not uncommon for instances to attempt to renew their lease well before exceeding the lease duration. However, the value set for dhcp_lease_duration does not dictate how long an IP address stays associated with an instance. Once an IP address has been allocated to an instance by Neutron, it remains associated with the instance until the instance or the port is deleted, even if the instance is shut off. Instances typically rely on DHCP to obtain their address, though, which is why this configuration option is important.

edit flag offensive delete link more


Thank you, you clarified things for me :) As for running out of IPs, I don't think that's gonna happen in my cloud anytime soon, since you said that DHCP goes back to the beginning of the pool automatically, and I have a lot of available IPs there.

Campos gravatar imageCampos ( 2016-09-20 12:40:17 -0500 )edit

answered 2016-09-20 11:37:40 -0500

when dhcp leases expire it will gather these addresses and use them again. if you are running out you may want to shorten your dhcp expiration time or increase your subnet.....

to change the lease time, in your neutron.conf:

neutron.conf:#dhcp_lease_duration = 86400

looks like by default is at one day if you are using openstack dnsmasq dhcp. Leases may be longer if using other dhcp providers (like physical router).

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2016-09-20 09:22:09 -0500

Seen: 748 times

Last updated: Sep 20 '16