Dnsmasq might be broken


i have some issues with dnsmasq DHCP feature. I have setup a static lease for a client, but the client never get that ip.. its always the same but not the configured one.

config host
        option name 'MacBookPro-Arbeit'
        option dns '1'
        option ip ''
        option hostid '0176'
        option mac 'C8:89:F3:E4:DE:7B'
        option instance '5'
        list match_tag 'known'
        option duid '000100012aee5001c889f3e4de7b'

IPv6 is fine, but IPv4 didnt work. The log isn helpfull at all. It looks like, something fucked up here :frowning:

PS: I have that issue for multiple devices and its always related to IPv4

Seeing the whole DHCP configuration would be a helpful starting point..


MACs use randomized MAC addresses too, perhaps ?


How many instances of dnsmasq are you running? What’s the rest of the dhcp config?

What messages appear in logread when the client connects?


Sorry, was playing around a bit.

odhcpd is providing the RIGHT ip-adresses, however other stuff breaks then, mainly due to the multiple dnsmasq intances before .. so it is INDEED a dnsmasq issue.

For the config:
its quite big, i will provide some snippets:

I have multiple instances for multiple vlans.


2023-09-11T13:50:39+02:00 openwrt dnsmasq-dhcp[1]: DHCPDISCOVER(eth0) e0:63:da:5c:e6:b0
2023-09-11T13:50:39+02:00 openwrt dnsmasq-dhcp[1]: DHCPOFFER(eth0) e0:63:da:5c:e6:b0
2023-09-11T13:50:39+02:00 openwrt dnsmasq-dhcp[1]: DHCPREQUEST(eth0) e0:63:da:5c:e6:b0
2023-09-11T13:50:39+02:00 openwrt dnsmasq-dhcp[1]: DHCPACK(eth0) e0:63:da:5c:e6:b0 Wohnzimmerswitch
2023-09-11T13:50:40+02:00 openwrt dnsmasq-dhcp[1]: DHCPDISCOVER(eth0) e0:63:da:5c:e6:b0
2023-09-11T13:50:40+02:00 openwrt dnsmasq-dhcp[1]: DHCPOFFER(eth0) e0:63:da:5c:e6:b0
2023-09-11T13:50:40+02:00 openwrt dnsmasq-dhcp[1]: DHCPREQUEST(eth0) e0:63:da:5c:e6:b0
2023-09-11T13:50:40+02:00 openwrt dnsmasq-dhcp[1]: DHCPACK(eth0) e0:63:da:5c:e6:b0 Wohnzimmerswitch

Where the config for the related device is:

config dhcp 'SERVERS'
        option instance 'SERVERS_dns'
        option interface 'SERVERS'
        option start '100'
        option limit '239'
        option ra_useleasetime '1'
        option force '1'
        option ra 'server'
        option dhcpv6 'server'
        list ra_flags 'managed-config'
        list ra_flags 'other-config'
        option ra_slaac '0'
        option leasetime '7d'
        list domain 'servers.dmopp.de'
        list dhcp_option '42,'
        list dhcp_option '6,'
        list dns 'fd11:192:168:1::10'
        option ndp 'hybrid'
        option ra_default '2'
config dnsmasq 'SERVERS_dns'
        option local_ttl '0'
        option domainneeded '1'
        option localise_queries '1'
        option expandhosts '1'
        option authoritative '1'
        option readethers '1'
        list addnhosts '/tmp/odhcpd.leases'
        option localservice '1'
        option rebind_protection '1'
        option rebind_localhost '1'
        option ednspacket_max '1232'
        list interface 'SERVERS'
        option local '/servers.dmopp.de/'
        option domain 'servers.dmopp.de'
        option leasefile '/tmp/dhcp.leases.servers'
        list notinterface 'loopback'
config host
        option dns '1'
        option mac 'e0:63:da:5c:e6:b0'
        option hostid '09'
        option ip ''
        option name 'Wohnzimmerswitch'
        option instance '2'
        list match_tag 'known'

Nope, iam checking the right mac addresses

Please provide it all. Snippets are not nearly as useful as you might think.

1 Like

That will not work on a /24 subnet


In that case, they are, because its a 1:1 Copy with changed names and interfaces.

Existing non-expired dynamic leases take precedence.

1 Like

That address isn't going to fall within the DHCP range. Hardly surprising it's not being handed out.

Thx, this was one error on my side and now fixed for all

afaik, and this was the case for the time before, static ips didnt need to be in the pool. if this changed, the docs shoudl be updated

Ok, let's see the whole /etc/config/network and /etc/config/dhcp files.

1 Like

shouldt this be in the leasefile? so stop dnsmasq, delete lease file, start dnsmasq ? I tried this, but its wroting the wrong ip there instead.

@krazeh again. This would NOT help, its copy/paste so if you cant find an issue in this config lines, u cant find an issue in the others (and vice-versa, thats why iam fixed the limit already)

I tried to stop,delete,start and now its getting ANOTHER ip adress (not the same anymore) but still the wrong one. Looks the the static elases are beeing ignored since the latest snapshot :frowning: )

Ok then, good luck with your issue. Hopefully others will be happy to try and work it out based on the limited info you want to drip feed.

1 Like

I guess you are a bot, because u cant really understand what i wrote down. U can see ALL you need, the other stuff is the S A M E but different names. The static leases, apart from the one with the issues, are not relevant.

No. We can see all you think we need to see. There's a big difference between that and seeing everything. You might think your config files are absolutely fine (and you might be right), but time and time again issues have only been solved after the poster has finally given us what we asked for and it turns out there was simple misconfiguration issues.


"Hi, I have an issue I need you to solve for me, but I'll only provide you with the info I think is relevant ...."

GL with that.


Not wanting to wade into this debate, but please stay civil. If on a forum like this, people actually interact with your question, just be grateful; and if some responses seem not to your liking, please ignore them politely.