Provide dhcp-range even for static inventory

The dnsmasq man page says, regarding the dhcp-host option:

  Addresses allocated like this are not constrained to be in the range
  given by the --dhcp-range option, but they must be in the same subnet
  as some valid dhcp-range.

This confusingly-worded datum means that even when dhcp-host is
defined, which we do when setting inventory_dhcp=true, we need to
specify some kind of dhcp-range. There are a few valid arguments we
could supply to the dhcp-range parameter, but the easiest is just to go
back to using the existing dhcp_pool_{start,end} parameters, from which
dnsmasq will infer a subnet.

An alternative to this is to be more strict by using the 'static'
keyword for dhcp-range. We would still need to specify the
dhcp_pool_start value, which is a required argument for dhcp-range.

Change-Id: I4d09c3a716b864c0b0d74cc83a2f0ac7414b386c
This commit is contained in:
Colleen Murphy 2015-11-25 15:56:33 -08:00
parent ae05e413b6
commit 1d31fdd785

View File

@ -154,13 +154,11 @@ dhcp-hostsfile=/etc/dnsmasq.d/bifrost.dhcp-hosts.d
# a lease time. If you have more than one network, you will need to # a lease time. If you have more than one network, you will need to
# repeat this for each network on which you want to supply DHCP # repeat this for each network on which you want to supply DHCP
# service. # service.
{% if not inventory_dhcp %}
{% if testing %} {% if testing %}
dhcp-range=192.168.122.2,192.168.122.254,12h dhcp-range=192.168.122.2,192.168.122.254,12h
{% else %} {% else %}
dhcp-range={{dhcp_pool_start}},{{dhcp_pool_end}},{{dhcp_lease_time}} dhcp-range={{dhcp_pool_start}},{{dhcp_pool_end}},{{dhcp_lease_time}}
{% endif %} {% endif %}
{% endif %}
# This is an example of a DHCP range where the netmask is given. This # This is an example of a DHCP range where the netmask is given. This
# is needed for networks we reach the dnsmasq DHCP server via a relay # is needed for networks we reach the dnsmasq DHCP server via a relay