Ok, so, I have a Netgear router that doesn’t allow me to set rules for redirecting devices that try to bypass the piholes DNS. I can set an IP range I want to block/redirect and that will work. My pihole is my DHCP server because for my router doesnt show info about which devices are doing what on the pihole; its all jumbled together. I wanted to have one device (iPad) bypass the pihole, but I obviously cant set the IP on my router since the pihole is the DHCP server and I cant manually set a different DNS on the device itself because of the rule I set in the router (it would get blocked).
So I asked on reddit and someone helped me. They told me I could insert this rule:
dhcp-host=<the mac address of the ipad>,set:customdns,192.168.1.200 (the IP of the iPad) dhcp-option=tag:customdns,option:dns-server,18.104.22.168,22.214.171.124
I am extremely bad at this kind of stuff so I have a few questions:
- Why isnt the pihole dhcp server assigning the IP automatically? I have to manually set it.
- Can this be damaging my installation? Since i have set this code, when I restart the pihole, it doesnt work anymore…the DNS service doesnt start running again.
- How does this work, exactly? If the DNS set in the device is not the DNS of the pihole, wouldnt it just bypass it completely (I did change the DNS in the device to 126.96.36.199,188.8.131.52) and then be blocked by the rules in my router?
- Before doing this, I had my pihole assign IPs from 192.168.1.201-192.168.1.251. I then changed it to 192.168.1.200-192.168.1.251 and set the IP in the rule created to 192.168.1.200. Should I have kept the IP pool at 192.168.1.201-192.168.1.251 or changed it to 192.168.1.200-192.168.1.251 like I did?
- Is there any easier way to do this that I’m missing? I feel like this is overly complicated. Before I would just go into the iPad and set the DNS server manually but I cant do that now because the router blocks it. I honestly am too illiterate in technological matters to know how it was getting an IP from the pihole but was able to bypass it.
Edit: this was the reply from the kind user who helped me figure this out:
Interesting question! It is possible to use custom configs on the pihole via the /etc/dnsmasq.d/ directory
Assuming the following:
Your DHCP pool is a subset of your subnet (ex. 192.168.1.1 thru 192.168.1.64)
Your router allows you to specify DNS redirect for just the above range
I would allocate an IP outside of your DHCP pool using the dhcp-host option, use the ‘set’ key to tag it, and call the tag to apply a custom DHCP option to just that tag.
Example, untested, in
Restart dnsmasq and networking on your iPad to test.