dnsmasq pool without assigned ip

I have a simple dnsmasq v2.80 in an embedded device which I want to use as DHCP server for autoprovisioning purposes.

I want two pools (one static and one dynamic)

What I have is this one:

#
# main dnsmasq config file
#

user=nobody
group=nogroup

log-dhcp
dhcp-authoritative
dhcp-rapid-commit
no-dhcp-interface=lo
dhcp-name-match=set:wpad-ignore,wpad
dhcp-ignore-names=tag:wpad-ignore
dhcp-leasefile=/var/lib/misc/dnsmasq.leases

dhcp-option=tag:v69_static_pool_1,option:dns-server,1.2.3.254
dhcp-option=tag:v69_static_pool_1,option:router,1.2.3.253
dhcp-option=tag:v69_static_pool_1,option:ntp-server,1.2.3.252

dhcp-range=set:v69_dynamic_pool_1,10.250.0.2,10.250.0.254,255.255.255.0,12h
dhcp-option=tag:v69_dynamic_pool_1,option:dns-server,10.250.0.1
dhcp-option=tag:v69_dynamic_pool_1,option:router,10.250.0.1
dhcp-option=tag:v69_dynamic_pool_1,option:ntp-server,10.250.0.1

dhcp-range=1.2.3.1,1.2.3.254,255.255.255.0,infinite
dhcp-host=dc:2c:6e:ef:09:33,1.2.3.2,set:v69_static_pool_1

and the network interface

   link/ether ba:86:04:04:64:44 brd ff:ff:ff:ff:ff:ff
   inet 10.250.0.1/24 scope global v69
      valid_lft forever preferred_lft forever
   inet 1.2.3.1/24 scope global v69
      valid_lft forever preferred_lft forever
   inet6 fe80::b886:4ff:fe04:6444/64 scope link 
      valid_lft forever preferred_lft forever

But what I want is to don’t waste ip addresses because I will be using public IP addresses to assign to cpes in a network. I’m used to work with mikrotik routers and while the interface has a static ip address is enought to allow me to assign IP’s out of the interface range.

And also I want to assure that the static pool is not used to assign to dynamic hosts.

Is it possible with dnsmasq?

Asked By: Radu Radu

||

And also I want to assure that the static pool is not used to assign to dynamic hosts.

If you don’t want to hand out dynamic addresses from a DHCP range, using the static keyword, described in the documentation:

The optional <mode> keyword may be static which tells dnsmasq to enable DHCP
for the network specified, but not to dynamically allocate IP addresses: only
hosts which have static addresses given via –dhcp-host or from /etc/ethers
will be served.

That would look something like this:

dhcp-option=tag:v69_static_pool_1,option:dns-server,1.2.3.254
dhcp-option=tag:v69_static_pool_1,option:router,1.2.3.253
dhcp-option=tag:v69_static_pool_1,option:ntp-server,1.2.3.252

dhcp-range=set:v69_static_pool_1,1.2.3.1,static,255.255.255.0,infinite
dhcp-host=dc:2c:6e:ef:09:33,1.2.3.2
Answered By: larsks
Categories: Answers Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.