[Solved] DHCP not assigning static addresses

Hello community,

I am back :slight_smile:
I was successfully able to install and configure OpenWRT on x86 machine with 3x interfaces. Everything was working fine, except today my static DHCP leases have stopped working. I have deleted everything on static lease but still no dice .... not sure what am I missing. Here are details:

System: Apple MacMini (Intel x86 architecture)

eth0 = LAN (built-in port)
eth1 = WAN (thunderbolt gigabit link)
eth2 = LAN2 (thunderbolt gigabit link). --> has 2x VLANs (vlan_500 and vlan_666)
System is configured for multiple instances of dnsmasq.
Using an external DNS (pi-hole) for adblocking (no DHCP running on Pi-hole).

Config files:

Network config

config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fda3:a827:68a2::/48'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'eth0'
	option ipv6 '0'

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option ipaddr '192.168.9.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

config interface 'wan'
	option device 'eth1'
	option proto 'dhcp'
	option hostname '*'

config interface 'wan6'
	option device 'eth1'
	option proto 'dhcpv6'

config device
	option type '8021q'
	option ifname 'eth2'
	option vid '500'
	option name 'eth2.500'
	option ipv6 '0'

config interface 'vlan_500'
	option proto 'static'
	option device 'eth2.500'
	option ipaddr '172.31.31.1'
	option netmask '255.255.255.0'

config device
	option type '8021q'
	option ifname 'eth2'
	option vid '666'
	option name 'eth2.666'
	option ipv6 '0'

config interface 'vlan_666'
	option proto 'static'
	option device 'eth2.666'
	option ipaddr '10.10.10.1'
	option netmask '255.255.255.0'
DHCP config

config odhcpd 'odhcpd'
	option maindhcp '0'
	option leasefile '/tmp/hosts/odhcpd'
	option leasetrigger '/usr/sbin/odhcpd-update'
	option loglevel '4'

config dnsmasq 'lan_dns'
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/lan/'
	option domain 'alamo'
	option expandhosts '1'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases.lan'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	option localservice '0'
	list interface 'lan'

config dhcp 'lan'
	option instance 'lan_dns'
	option interface 'lan'
	option start '100'
	option limit '150'
	option leasetime '12h'
	list dhcp_option '6,192.168.9.5'

config dnsmasq 'vlan_500_dns'
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/vlan_500/'
	option domain 'guest'
	option expandhosts '1'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases.vlan_500'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	list interface 'vlan_500'
	list notinterface 'loopback'
	option localservice '0'

config dhcp 'vlan_500'
	option instance 'vlan_500_dns'
	option interface 'vlan_500'
	option start '100'
	option limit '150'
	option leasetime '12h'

config dnsmasq 'vlan_666_dns'
	option domainneeded '1'
	option localise_queries '1'
	option rebind_protection '1'
	option rebind_localhost '1'
	option local '/vlan_666/'
	option domain 'iot'
	option expandhosts '1'
	option authoritative '1'
	option readethers '1'
	option leasefile '/tmp/dhcp.leases.vlan_666'
	option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
	list interface 'vlan_666'
	list notinterface 'loopback'
	option localservice '0'

config dhcp 'vlan_666'
	option instance 'vlan_666_dns'
	option interface 'vlan_666'
	option start '100'
	option limit '150'
	option leasetime '12h'

config host
	option name 'winot-living-room-mesh'
	option mac '78:8C:B5:3B:6F:10'
	option ip '192.168.9.10'
	option leasetime 'infinite'
	list match_tag 'known'
	option instance '0'

config host
	option name 'winot-office-mesh'
	option mac '78:8C:B5:3B:93:8C'
	option ip '192.168.9.11'
	list match_tag 'known'
	option instance '0'
	option leasetime 'infinite'

config host
	option name 'winot-master-bed-room-mesh'
	option mac '78:8C:B5:3B:6F:0C'
	option ip '192.168.9.12'
	option leasetime 'infinite'
	list match_tag 'known'
	option instance '0'

config host
	option name 'homebridge'
	option mac '08:00:27:7F:FE:DC'
	option ip '192.168.9.70'
	option leasetime 'infinite'
	list match_tag 'known'
	option instance '0'

config host
	option name 'pi-hole'
	option mac '08:00:27:9F:1B:A1'
	option ip '192.168.9.5'
	option leasetime 'infinite'
	list match_tag 'known'
	option instance '0'

config host
	option name 'garage-door'
	option mac '08:F9:E0:4B:0E:5E'
	option ip '192.168.9.40'
	option leasetime 'infinite'
	list match_tag 'known'
	option instance '0'

DHCP / dnsmasq is working but for some reason not assigning the static addresses. Here is a log output from a device which is statically mapped but keeps going to a different IP address:

Fri Jan 26 22:40:49 2024 daemon.info dnsmasq-dhcp[1]: DHCPDISCOVER(br-lan) 08:f9:e0:4b:0e:5e
Fri Jan 26 22:40:49 2024 daemon.info dnsmasq-dhcp[1]: DHCPOFFER(br-lan) 192.168.9.118 08:f9:e0:4b:0e:5e
Fri Jan 26 22:40:49 2024 daemon.info dnsmasq-dhcp[1]: DHCPREQUEST(br-lan) 192.168.9.118 08:f9:e0:4b:0e:5e
Fri Jan 26 22:40:49 2024 daemon.info dnsmasq-dhcp[1]: DHCPACK(br-lan) 192.168.9.118 08:f9:e0:4b:0e:5e ESP-4B0E5E
Fri Jan 26 22:40:50 2024 daemon.info dnsmasq-dhcp[1]: DHCPREQUEST(br-lan) 192.168.9.118 08:f9:e0:4b:0e:5e
Fri Jan 26 22:40:50 2024 daemon.info dnsmasq-dhcp[1]: DHCPACK(br-lan) 192.168.9.118 08:f9:e0:4b:0e:5e

Any ideas what could be going on ?

Remove these three lines:

Then restart the dnsmasq service or reboot the router and try again.

Made the change for one of the device and rebooted .... solved the issue.

Fri Jan 26 22:58:38 2024 daemon.info dnsmasq-dhcp[1]: DHCPDISCOVER(br-lan) 08:f9:e0:4b:0e:5e
Fri Jan 26 22:58:38 2024 daemon.info dnsmasq-dhcp[1]: DHCPOFFER(br-lan) 192.168.9.40 08:f9:e0:4b:0e:5e
Fri Jan 26 22:58:38 2024 daemon.info dnsmasq-dhcp[1]: DHCPREQUEST(br-lan) 192.168.9.40 08:f9:e0:4b:0e:5e
Fri Jan 26 22:58:38 2024 daemon.info dnsmasq-dhcp[1]: DHCPACK(br-lan) 192.168.9.40 08:f9:e0:4b:0e:5e garage-door

Which one of these options are causing issue?

I'm not sure which one is actually causing the issue... I just know that the three lines aren't necessary. You could experiment by putting one line at a time in the config and then see when it fails again. If you do this, please report back with your findings.

If your problem is solved, please consider marking this topic as [Solved]. See How to mark a topic as [Solved] for a short how-to.
Thanks! :slight_smile:

At least neither of those three make any sense, until you actually configure (diverging behaviour for-) them - and infinite lease times make any issues even harder to resolve.

I had to remove all three items to make DHCP static leases to work ... I will edit the DHCP file (from backup) and remove all of these entries ... wonder why it worked before ...

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.