Bypassing / Excluding IP address from Pi-Hole not working

Please follow the below template, it will help us to help you!

Expected Behaviour:

After following the directions on this post:

I have created a file on /etc/dnsmasq.d called 04-bypass.conf, and reboot the server.

pi@raspberrypi:~ $ cat /etc/dnsmasq.d/04-bypass.conf
dhcp-option=tag:cloudflare1,6,1.1.1.1
dhcp-option=tag:cloudflare2,6,1.0.0.1

dhcp-host=XX:XX:XX:XX:XX:AA,set:cloudflare1

However, that client (Windows 10) is still getting DNS server as the Pi-Hole (192.168.0.4)

Wireless LAN adapter Wi-Fi:

Connection-specific DNS Suffix . : lan
Description . . . . . . . . . . . : Intel(R) Dual Band Wireless-AC 8265
Physical Address. . . . . . . . . : XX:XX:XX:XX:XX:AA
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Lease Obtained. . . . . . . . . . : Thursday, September 26, 2019 10:33:10 AM
Lease Expires . . . . . . . . . . : Wednesday, October 2, 2019 11:37:55 PM
IPv4 Address. . . . . . . . . . . : 192.168.0.41(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.1
DHCP Server . . . . . . . . . . . : 192.168.0.4
DNS Servers . . . . . . . . . . . : 192.168.0.4
NetBIOS over Tcpip. . . . . . . . : Enabled

Actual Behaviour:

Expect that the client with mac address XX:XX:XX:XX:XX:AA to use Cloudflare DNS servers

Debug Token:

I will provide once I clear the logs - the client is my corporate notebook, so there are calls to internal /company network servers.

Is the Pi-Hole the DHCP server? If not, none of these DHCP options will push to clients.

Yes, Pi-Hole is the DHCP server.
That MAC address also gets a fixed IP - I allocate all my gear to a fixed IP outside the DHCP range (192.168.0.100-250)

Flushed DNS cache on Windows machine and renewed lease? And double checked the MAC address?

Yes, and yes.

But I did some other tests:
1: Removed the static ip address assignment for my phone, and I added another entry on the file for my Android phone mac address to use Cloudflare... PASSED
2. Removed the static ip address assignment for the Windows 10 client on Pi-Hole, flushdns, release, renew.. PASSED
3. Tried to have both the static ip and the DNS address assignment configs at the same time.. FAILED

Now the question is how I get both to work at the same time? I'm fine with the workaround with dynamic IP and DNS set, but it would be great if I can get both to work.

Assuming you are issueing static leases via Pi-hole's web UI:
It seems that Pi-hole stores information on static leases in
/etc/dnsmasq.d/04-pihole-static-dhcp.conf
This configuration file employs the dhcp= option as well, and values defined there seem to take precedence over your own settings.

You can manipulate the entries in 04-pihole-static-dhcp.conf directly, which will give the result you desire, but I advise CAUTION.
You'll likely be stuck with editing static leases manually ever after, since the Pi-hole admin panel doesn't agree well with this:


I suspect that adding another static lease using Settings|DHCP panel could render some DHCP leases unusable, but haven't tried that.

I wouldn't recommend this as a general solution, but only if you feel comfortable with it and if you're familiar with dnsmasq, it's probably worth a try.

Keep in mind that this file is under Pi-hole's control, so can be affected at any time to Pi-holes liking, maybe so during updates.

As I am just a Pi-hole user, I'd recommend you should seek confirmation by a moderator that indeed there is no better way to reach your goal before you permanently employ this workaround.