DHCP Static Lease problems

Openwrt 23.05.2

  1. Debian Bookworm Rock64 DHCP client connected via Ethernet switch.

I have tried multiple reboots of router and client, deleting and recreating static lease entry. I have also verified the MAC address on the device and on the router log. The client does get an IP address from the pool but not the designated static address. Other devices on the network are getting a static DHCP addresses.

  1. Obi302 VOIP adapter connected directly to the Ethernet port of the router
    It does get a designated static DHCP address but does not show up in the "Active DHCP" Leases section.

Unless the IP address is critical and must be x.x.x.x then just let DHCP assign it a lease and then on the status page around the middle is Active DHCP Leases, find the device and click 'set static'.

It is not going to show up there if it is static.

Static ip for pi-hole in DHCP settings

Static address on status page

Active leases not showing static leases

Activate logging for dnsmasq and add the following lines to your /etc/config/dhcp:

config dnsmasq
        option logfacility '/var/log/dnsmasq.log'
        option logqueries '1'
        option logdhcp '1'

Restart dnsmasq and post the logging after the client got his IP address.

dnsmasq will tell you, why your client doesn't get the designated address.

Please connect to your OpenWrt device using ssh and copy the output of the following commands and post it here using the "Preformatted text </> " button:
Remember to redact passwords, MAC addresses and any public IP addresses you may have:

ubus call system board
cat /etc/config/network
cat /etc/config/dhcp

Solved but not sure how....
@Barney Logging was a good help. tail -f worked like a charm while I was renewing lease from a client.

@psherman DHCP file had this entry for the rockchip host

config host
	option mac 'F8:F8:F8:F8:BA:8F'
	option ip ''
	option leasetime '12h'
	option instance '0'
	option name 'samba'

option instance '0' is not present for other static leases. I removed that. Then cleared the entry in /tmp/dhcp.leases file for that machine. Rebooted rockchip samba server and it started working. What does option instance '0' do?

I also noticed that I can create a static DHCP ip address for the host outside the range specified, and it will still deliver it to the client. This is nice.

@LilRedDog The IP address is not critical but nice to have. It is for a samba server. that is hardcoded in to other clients. Obi 302 adapter is getting a static DHCP lease address. As such it is still DHCP. So I expect it to be shown in current leases. Now it is showing up along with samba server. Not sure how.

Per the documentation:

Dnsmasq instance to which the dhcp section is bound; if not specified the section is valid for all dnsmasq instances.

Since you probably only have a single instance of dnsmasq running, you don't need or want this specified. My guess (although I could be wrong) is that instance 0 caused the entry to be ignored. (this is on the presumption that the running instance = 1, and that it is not zero referenced).

@psherman Got it thanks. I am using only one instance of dnsmasq. I have been configuring static leases from GUI. I checked again. It was my mistake to select instance 0 (or a bug?). The help below instance option says...

select the domain and I did select lan domain. (my .lan domain is supposedly zero). I have removed it now and it works.

I'm not entirely certain -- I'd have to experiment. But by keeping it unspecified, it ensures that the entry is used by your dnsmasq instance without any abiguitiy.

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:

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