Static IP reservation is ignored by dnsmasq when using Pi Hole as my DHCP server

The issue I am facing:

Title pretty much says it all.

Details about my system:

Pi -hole is running on a Raspberry Pi 4B (2GB), the client in question is a MacBook Pro M3 Pro (2023), and my router is a Netgear Nighthawk RAX10, which has its DHCP server turned off and is configured to use only the Pi for DNS.

What I have changed since installing Pi-hole:

Installed unbound on the Pi and set it as my local recursive DNS server, and enabled Pi-hole's DHCP server. Then I set up my router as described above, restarted the MacBook Pro and expected its DHCP lease to be renewed, but it wasn't, even after multiple attempts to force this behaviour via the System Settings GUI and various CLI commands.

The only clue I can see in my logs is this snippet from pihole.log:

Jan 14 14:08:21 dnsmasq-dhcp[70110]: DHCPREQUEST(enabcm6e4ei0) 192.168.1.10 60:3e:5f:7d:a2:bc
Jan 14 14:08:21 dnsmasq-dhcp[70110]: DHCPNAK(enabcm6e4ei0) 192.168.1.10 60:3e:5f:7d:a2:bc static lease available
Jan 14 14:08:21 dnsmasq-dhcp[70110]: DHCPDISCOVER(enabcm6e4ei0) 60:3e:5f:7d:a2:bc
Jan 14 14:08:21 dnsmasq-dhcp[70110]: DHCPOFFER(enabcm6e4ei0) 192.168.1.3 60:3e:5f:7d:a2:bc
Jan 14 14:08:22 dnsmasq-dhcp[70110]: DHCPREQUEST(enabcm6e4ei0) 192.168.1.3 60:3e:5f:7d:a2:bc
Jan 14 14:08:22 dnsmasq-dhcp[70110]: DHCPACK(enabcm6e4ei0) 192.168.1.3 60:3e:5f:7d:a2:bc MACBOOK-PRO
Jan 14 14:08:23 dnsmasq-dhcp[70110]: DHCPDECLINE(enabcm6e4ei0) 192.168.1.3 60:3e:5f:7d:a2:bc
Jan 14 14:08:23 dnsmasq-dhcp[70110]: disabling DHCP static address 192.168.1.3 for 10m

The last two lines are the most troubling...they describe what the obvious problem is, but don't give an actual reason why the static address is being declined/disabled.

Debug token: 73oALRr9. MTIA :slight_smile:

Your client requests to be assigned 192.168.1.10, which Pi-hole refuses to acknowledge, as that MAC is configured for a different IP(.3):

-rw-r--r-- 1 root root 52 Jan 14 04:49 /etc/dnsmasq.d/04-pihole-static-dhcp.conf
   dhcp-host=60:3E:redacted,192.168.1.3,MACBOOK-PRO

Your client then initiates a new DHCP lease negotiation via DHCPDISCOVER, where Pi-hole's DHCP server correctly offers that 192.168.1.3, but your client ultimately declines it. Edit: I'd usually expect it to do so upon detecting another node is already using that IP.

You should scrutinize why your client wants 192.168.3.10 (which also happens to be your Pi-hole host's IP), and you may want to set Pi-hole's lease-time from infinite to something like a day.

If you perhaps manually had set a static IP on your Macbook, you should consider an IP outside of Pi-hole's DHCP pool (which may require shrinking its current pool size, spanning almost all your subnet's addresses except one).

-rw-r--r-- 1 root root 498 Jan 14 16:00 /etc/dnsmasq.d/02-pihole-dhcp.conf
   dhcp-range=192.168.1.3,192.168.1.254,infinite
1 Like

Hmm OK, when I had noticed those lines in pihole.log that mention .10 myself, I assumed that they were talking about the Pi, not the Mac. But OK, the situation makes a little more sense now; thanks for the clarification.

I'd really prefer to avoid setting a static IP on the Mac through its own system settings, and the reason I've set my DHCP pool to be that specific size is because .2 is a switch/dumb AP in my lounge room, and I want Pi-hole to take care of DHCP address allocations for all other devices in my LAN.

I don't want to have to think about this stuff ever again once I finally get it all working, and want to have the most basic and simple-to-setup LAN configuration possible, so setting a smaller pool size and assigning static IPs on the clients themselves is something that I really don't want to (and shouldn't have to!) do.

I know this is a Pi-hole forum, not a Mac forum, but do you have any ideas why macOS is outright refusing to take a new lease? Or why it wants .10 or .125 so badly? Thanks again :smiley:

EDIT: Do clients have their own separate ARP cache that is perhaps getting in the way here? I don't know enough about DHCP/ARP to understand why the Mac is so determined to keep the address it knows and seemingly loves so very much lol.

One possible cause would be a static IP in the Macbook, which is why I was wondering if you had set a static IP on it (not asking you to set one - I've edited my previous post for that to be more obvious).

Another reason could be your infinite lease time, if you had been juggling around with IPs before you settled on IPs for your Pi-hole host and your Macbook, e.g. if your Macbook had acquired an infinite lease for your .10 at some stage.

Thanks for the suggestions, but I finally solved it and it was neither of those things. Turns out my Dad's office PC was hogging .3 all along! I've been racking my brain and banging my head against this wall all day, and it was as simple as that! :rofl:

For some reason (I guess because it already had a valid lease?) the office PC wasn't showing up in Pi-hole's list of currently-assigned leases, so I never realised the misconfiguration until I noticed that, went to the PC and manually ran ipconfig. That told me the obvious problem, which was solved by simply setting up another static reservation in Pi-hole and running ipconfig /release and ipconfig /renew.

Then I was finally able to get the "Renew DHCP Lease" button in the Mac's System Settings to actually do what I expected it to all along lol. Anyway thanks for pointing me in the right direction, and have a great day! :smiley:

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