Discussion:
[Dnsmasq-discuss] dnsmasq offering dynamic instead of static dhcp leases - what am I doing incorrectly?
Michael Evans
2016-02-12 00:29:52 UTC
Permalink
Re-sending after temporarily subscribing
My goal is to have dnsmasq serve DHCP leases on an interface, either for
static addresses (either within that interface's very large subnet mask)
state UP group default qlen 1000
link/ether de:ad:be:af:f0:0d brd ff:ff:ff:ff:ff:ff
inet 10.0.0.2/16 brd 10.0.255.255 scope global eth1
valid_lft forever preferred_lft forever
inet6 fe80::dcad:beff:feaf:f00d/64 scope link
valid_lft forever preferred_lft forever
Using a config-dir entry (which is scanned according to the ranges)
interface=eth1
expand-hosts
dhcp-leasefile=/var/lib/misc/dnsmasq.leases
domain=example.com,10.0.0.0/16,local
dhcp-range=10.0.4.1,10.0.8.250,255.255.0.0,1h
dhcp-range=tag:staticdhcp,10.0.0.0,static,255.255.0.0,1h
# dhcp-options slipped for brevity
dhcp-host=de:ad:be:ef:55:55,id:*,10.0.0.10 # ,hnstatic,infinite
Yet the offered address is from the dynamic range.
Feb 12 00:09:00 testDnsmasq dnsmasq[312]: started, version 2.72 cachesize
150
Feb 12 00:09:00 testDnsmasq dnsmasq[312]: compile time options: IPv6
GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth
DNSSEC loop-detect
Feb 12 00:09:00 testDnsmasq dnsmasq-dhcp[312]: DHCP, static leases only on
10.0.0.0, lease time 1h
Feb 12 00:09:00 testDnsmasq dnsmasq-dhcp[312]: DHCP, IP range 10.0.4.1 --
10.0.8.250, lease time 1h
Feb 12 00:09:00 testDnsmasq dnsmasq[312]: using local addresses only for
domain 0.10.in-addr.arpa
Feb 12 00:09:00 testDnsmasq dnsmasq[312]: reading /etc/resolv.conf
Feb 12 00:09:00 testDnsmasq dnsmasq[312]: using local addresses only for
domain 0.10.in-addr.arpa
Feb 12 00:09:00 testDnsmasq dnsmasq[312]: using nameserver 192.168.1.1#53
Feb 12 00:09:00 testDnsmasq dnsmasq[312]: read /etc/hosts - 4 addresses
Feb 12 00:09:00 testDnsmasq systemd[1]: Started dnsmasq - A lightweight
DHCP and caching DNS server.
Feb 12 00:09:06 testDnsmasq dnsmasq-dhcp[312]: 2573025057 available DHCP
range: 10.0.4.1 -- 10.0.8.250
Feb 12 00:09:06 testDnsmasq dnsmasq-dhcp[312]: 2573025057 available DHCP
subnet: 10.0.0.0/255.255.0.0
Feb 12 00:09:06 testDnsmasq dnsmasq-dhcp[312]: 2573025057 client provides
name: testStatic
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057
DHCPDISCOVER(eth1) de:ad:be:af:55:55
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 tags: eth1
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 DHCPOFFER(eth1)
10.0.7.62 de:ad:be:af:55:55
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 requested
options: 1:netmask, 28:broadcast, 2:time-offset, 3:router,
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 requested
options: 15:domain-name, 6:dns-server, 119:domain-search,
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 requested
options: 12:hostname, 44:netbios-ns, 47:netbios-scope,
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 requested
options: 26:mtu, 121:classless-static-route, 42:ntp-server
10.0.0.2
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 1
option: 53 message-type 2
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 4
option: 54 server-identifier 10.0.0.2
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 4
option: 51 lease-time 1h
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 4
option: 58 T1 30m
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 4
option: 59 T2 52m30s
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 4
option: 28 broadcast 10.0.255.255
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 4
option: 6 dns-server 10.0.0.2
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 11
option: 15 domain-name example.com
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 2
option: 26 mtu 9000
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 4
option: 3 router 10.0.0.1
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 4
option: 1 netmask 255.255.0.0
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 available DHCP
range: 10.0.4.1 -- 10.0.8.250
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 available DHCP
subnet: 10.0.0.0/255.255.0.0
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 client provides
name: testStatic
What am I doing incorrectly? How should the configuration file look?
Simon Kelley
2016-02-12 16:34:13 UTC
Permalink
Post by Michael Evans
Re-sending after temporarily subscribing
My goal is to have dnsmasq serve DHCP leases on an interface, either for
static addresses (either within that interface's very large subnet mask)
state UP group default qlen 1000
link/ether de:ad:be:af:f0:0d brd ff:ff:ff:ff:ff:ff
inet 10.0.0.2/16 brd 10.0.255.255 scope global eth1
valid_lft forever preferred_lft forever
inet6 fe80::dcad:beff:feaf:f00d/64 scope link
valid_lft forever preferred_lft forever
Using a config-dir entry (which is scanned according to the ranges)
interface=eth1
expand-hosts
dhcp-leasefile=/var/lib/misc/dnsmasq.leases
domain=example.com,10.0.0.0/16,local
dhcp-range=10.0.4.1,10.0.8.250,255.255.0.0,1h
dhcp-range=tag:staticdhcp,10.0.0.0,static,255.255.0.0,1h
# dhcp-options slipped for brevity
dhcp-host=de:ad:be:ef:55:55,id:*,10.0.0.10 # ,hnstatic,infinite
Yet the offered address is from the dynamic range.
Feb 12 00:09:00 testDnsmasq dnsmasq[312]: started, version 2.72 cachesize
150
Feb 12 00:09:00 testDnsmasq dnsmasq[312]: compile time options: IPv6
GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth
DNSSEC loop-detect
Feb 12 00:09:00 testDnsmasq dnsmasq-dhcp[312]: DHCP, static leases only on
10.0.0.0, lease time 1h
Feb 12 00:09:00 testDnsmasq dnsmasq-dhcp[312]: DHCP, IP range 10.0.4.1 --
10.0.8.250, lease time 1h
Feb 12 00:09:00 testDnsmasq dnsmasq[312]: using local addresses only for
domain 0.10.in-addr.arpa
Feb 12 00:09:00 testDnsmasq dnsmasq[312]: reading /etc/resolv.conf
Feb 12 00:09:00 testDnsmasq dnsmasq[312]: using local addresses only for
domain 0.10.in-addr.arpa
Feb 12 00:09:00 testDnsmasq dnsmasq[312]: using nameserver 192.168.1.1#53
Feb 12 00:09:00 testDnsmasq dnsmasq[312]: read /etc/hosts - 4 addresses
Feb 12 00:09:00 testDnsmasq systemd[1]: Started dnsmasq - A lightweight
DHCP and caching DNS server.
Feb 12 00:09:06 testDnsmasq dnsmasq-dhcp[312]: 2573025057 available DHCP
range: 10.0.4.1 -- 10.0.8.250
Feb 12 00:09:06 testDnsmasq dnsmasq-dhcp[312]: 2573025057 available DHCP
subnet: 10.0.0.0/255.255.0.0
Feb 12 00:09:06 testDnsmasq dnsmasq-dhcp[312]: 2573025057 client provides
name: testStatic
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057
DHCPDISCOVER(eth1) de:ad:be:af:55:55
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 tags: eth1
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 DHCPOFFER(eth1)
10.0.7.62 de:ad:be:af:55:55
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 requested
options: 1:netmask, 28:broadcast, 2:time-offset, 3:router,
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 requested
options: 15:domain-name, 6:dns-server, 119:domain-search,
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 requested
options: 12:hostname, 44:netbios-ns, 47:netbios-scope,
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 requested
options: 26:mtu, 121:classless-static-route, 42:ntp-server
10.0.0.2
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 1
option: 53 message-type 2
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 4
option: 54 server-identifier 10.0.0.2
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 4
option: 51 lease-time 1h
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 4
option: 58 T1 30m
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 4
option: 59 T2 52m30s
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 4
option: 28 broadcast 10.0.255.255
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 4
option: 6 dns-server 10.0.0.2
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 11
option: 15 domain-name example.com
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 2
option: 26 mtu 9000
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 4
option: 3 router 10.0.0.1
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 sent size: 4
option: 1 netmask 255.255.0.0
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 available DHCP
range: 10.0.4.1 -- 10.0.8.250
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 available DHCP
subnet: 10.0.0.0/255.255.0.0
Feb 12 00:09:09 testDnsmasq dnsmasq-dhcp[312]: 2573025057 client provides
name: testStatic
What am I doing incorrectly? How should the configuration file look?
dhcp-host=de:ad:be:ef:55:55,id:*,10.0.0.10 # ,hnstatic,infinite


This is the first thing I'd be suspicious of, the fields in dhcp-host
can come in any order, and they're typed with a load of dodgy heuristics
which I think your commenting-out may have confused. Try actually
deleting the commented out second and see if that helps.


Cheers,

Simon.
Michael Evans
2016-02-12 18:59:59 UTC
Permalink
What am I doing incorrectly? How should the configuration file look?
dhcp-host=de:ad:be:ef:55:55,id:*,10.0.0.10 # ,hnstatic,infinite
This is the first thing I'd be suspicious of, the fields in dhcp-host
can come in any order, and they're typed with a load of dodgy heuristics
which I think your commenting-out may have confused. Try actually
deleting the commented out second and see if that helps.
Cheers,
Simon.
I was worried something like that might be the case. I had actually also
tested the configuration as such, but there weren't any differences I could
spot.

interface=eth1
expand-hosts

dhcp-leasefile=/var/lib/misc/dnsmasq.leases

domain=example.com,10.0.0.0/16,local

dhcp-range=10.0.4.1,10.0.8.250,255.255.0.0,1h
dhcp-range=tag:staticdhcp,10.0.0.0,static,255.255.0.0,1h

dhcp-option=1,255.255.0.0
dhcp-option=3,10.0.0.1
dhcp-option=option:mtu,9000

dhcp-host=de:ad:be:ef:55:55,id:*,10.0.0.10


Somewhat oddly dhclient on the test VM doesn't accept the incorrectly
offered lease; but that is another issue.

Feb 12 18:52:38 testDnsmasq dnsmasq[113]: started, version 2.72 cachesize
150
Feb 12 18:52:38 testDnsmasq dnsmasq[113]: compile time options: IPv6
GNU-getopt DBus i18n IDN DHCP DHCPv6 no-Lua TFTP conntrack ipset auth
DNSSEC loop-detect
Feb 12 18:52:38 testDnsmasq dnsmasq-dhcp[113]: DHCP, static leases only on
10.0.0.0, lease time 1h
Feb 12 18:52:38 testDnsmasq dnsmasq-dhcp[113]: DHCP, IP range 10.0.4.1 --
10.0.8.250, lease time 1h
Feb 12 18:52:38 testDnsmasq dnsmasq[113]: using local addresses only for
domain 0.10.in-addr.arpa
Feb 12 18:52:38 testDnsmasq dnsmasq[113]: reading /etc/resolv.conf
Feb 12 18:52:38 testDnsmasq dnsmasq[113]: using local addresses only for
domain 0.10.in-addr.arpa
Feb 12 18:52:38 testDnsmasq dnsmasq[113]: using nameserver 192.168.1.1#53
Feb 12 18:52:38 testDnsmasq dnsmasq[113]: read /etc/hosts - 4 addresses
Feb 12 18:52:38 testDnsmasq systemd[1]: Started dnsmasq - A lightweight
DHCP and caching DNS server.
Feb 12 18:57:54 testDnsmasq dnsmasq-dhcp[113]: 1333999467 available DHCP
range: 10.0.4.1 -- 10.0.8.250
Feb 12 18:57:54 testDnsmasq dnsmasq-dhcp[113]: 1333999467 available DHCP
subnet: 10.0.0.0/255.255.0.0
Feb 12 18:57:54 testDnsmasq dnsmasq-dhcp[113]: 1333999467 client provides
name: testStatic
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467
DHCPDISCOVER(eth1) de:ad:be:af:55:55
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 tags: eth1
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 DHCPOFFER(eth1)
10.0.7.62 de:ad:be:af:55:55
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 requested
options: 1:netmask, 28:broadcast, 2:time-offset, 3:router,
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 requested
options: 15:domain-name, 6:dns-server, 119:domain-search,
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 requested
options: 12:hostname, 44:netbios-ns, 47:netbios-scope,
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 requested
options: 26:mtu, 121:classless-static-route, 42:ntp-server
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 next server:
10.0.0.2
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 1
option: 53 message-type 2
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 4
option: 54 server-identifier 10.0.0.2
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 4
option: 51 lease-time 1h
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 4
option: 58 T1 30m
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 4
option: 59 T2 52m30s
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 4
option: 28 broadcast 10.0.255.255
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 4
option: 6 dns-server 10.0.0.2
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 11
option: 15 domain-name example.com
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 2
option: 26 mtu 9000
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 4
option: 3 router 10.0.0.1
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 4
option: 1 netmask 255.255.0.0
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 available DHCP
range: 10.0.4.1 -- 10.0.8.250
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 available DHCP
subnet: 10.0.0.0/255.255.0.0
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 client provides
name: testStatic
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467
DHCPDISCOVER(eth1) de:ad:be:af:55:55
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 tags: eth1
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 DHCPOFFER(eth1)
10.0.7.62 de:ad:be:af:55:55
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 requested
options: 1:netmask, 28:broadcast, 2:time-offset, 3:router,
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 requested
options: 15:domain-name, 6:dns-server, 119:domain-search,
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 requested
options: 12:hostname, 44:netbios-ns, 47:netbios-scope,
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 requested
options: 26:mtu, 121:classless-static-route, 42:ntp-server
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 next server:
10.0.0.2
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 1
option: 53 message-type 2
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 4
option: 54 server-identifier 10.0.0.2
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 4
option: 51 lease-time 1h
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 4
option: 58 T1 30m
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 4
option: 59 T2 52m30s
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 4
option: 28 broadcast 10.0.255.255
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 4
option: 6 dns-server 10.0.0.2
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 11
option: 15 domain-name example.com
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 2
option: 26 mtu 9000
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 4
option: 3 router 10.0.0.1
Feb 12 18:57:57 testDnsmasq dnsmasq-dhcp[113]: 1333999467 sent size: 4
option: 1 netmask 255.255.0.0

Loading...