Ask Your Question

When is DHCP lease time used?

asked 2017-03-15 11:15:30 -0500

osexplorer gravatar image

Hi all,

The latest Openstack documentation for "Managing IP addresses" states that:

Each instance has a private, fixed IP address and can also have a public, or floating IP address. Private IP addresses are used for communication between instances, and public addresses are used for communication with networks outside the cloud, including the Internet. When you launch an instance, it is automatically assigned a private IP address that stays the same until you explicitly terminate the instance. Rebooting an instance has no effect on the private IP address.

I would expect that the validity of an IP address that has automatically been assigned by DHCP expires when the DHCP lease time is expired. According to above statement the IP address is kept until the instance is terminated (and all ports of the VM are terminated as well). It seems that the allocated IP address is not released at lease expiry and the release is independent of the parameter dhcp_lease_duration = 86400 in /etc/neutron/dhcp_agent.ini

In my concrete case the DHCP lease time will not be extended by sending periodically DHCPREQUEST's to avoid lease time expiry.

Can someone explain the usage of the dhcp_lease_duration parameter?

edit retag flag offensive close merge delete


You can set it to -1 to disable lease renewal. Otherwise, the instance will simply renew its lease periodically, though I am not certain why that would be useful. One thought: It is possible to change the port's IP address, which seems to conflict somewhat with the documentation you cite.

Bernd Bausch gravatar imageBernd Bausch ( 2017-03-15 22:51:12 -0500 )edit

You should see the lease time as the last component of the dnsmasq parameter --dhcp-range. Just run pgrep dnsmasq.

Bernd Bausch gravatar imageBernd Bausch ( 2017-03-15 22:53:00 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2017-03-16 03:28:59 -0500

osexplorer gravatar image

updated 2017-03-16 05:36:06 -0500

I am not looking about the configuration possibilities of the parameters , but how Openstack applies the DHCP lease handling. Lets assume there is a short lease time set, for example 120 sec. IP addresses are taken from a small address pool. There are so many VMs instantiated that the pool is exhausted. Now I want to add another VM. The lease of some of the previously instantiated VMs is expired. Will the instantiation of the new VM be successful? Will it get an IP address from one of the expired IP addresses? Note that in this example the lease (per IP address) shall not periodically be renewed.

According to the documentation the instantiation of the new VM should fail. Which also means that the definition of the lease time has no relevance.

Hi Bernd, thank you for your comments! Unfortunately Openstack does not distinguish between fixed and dynamically assigned IP addresses. There are treated somehow as the same. Maybe it is better to talk about "static fixed" and "fixed" IPs. For me a "static fixed" IP is an address that is defined and assigned to the port explicitly, i.e. explicitly defined on the port in a HOT template. These IP addresses do not expire and are released if the port is terminated.

Fixed IP addresses are assigned via DHCP. A port (in HOT) that is connected to a network can be defined without fixed IP address. The IP address is taken from the IP pool that is defined in the subnet definition for the respective network. Here I have expected that the validity of the address depends on the DHCP lease time.

edit flag offensive delete link more


Normally, a VM won't start when no IP address is available before it is launched. More precisely, the port to which the VM is connected can't be created without IP.

(I say "normally" because VMs have the option to start without network, or with network but without IP address, since Newton).

Bernd Bausch gravatar imageBernd Bausch ( 2017-03-16 04:59:34 -0500 )edit

But since a port has a fixed IP address (with the emphasis on fixed), when the lease expires dnsmasq presents the same IP address to the VM.

Bernd Bausch gravatar imageBernd Bausch ( 2017-03-16 05:00:37 -0500 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2017-03-15 11:15:30 -0500

Seen: 1,166 times

Last updated: Mar 16 '17