Better yet, disable DHCP on the router.
Setting it to DHCP Forwarder will make all the other options disappear, disabling DHCP, and just instructs the router to look elsewhere for the DHCP server.
Thanx for the replies guys! i will surely try this setup ! Seems much more straightforward.
I think the most general and “best” method on DD-WRT is to:
Services>services>Additional DNSMasq Options:
No other changes on DD-WRT are needed. Substitute the IP of your pi-hole for the 192.168.1.250 above. Why do it this way? 3 reasons:
- Per-host tracking on Pi-hole (i.e. logging of DNS requests tied to individual machines by their respective hostnames).
- The ability to resolve hostnames on the LAN.
- Ad blocking/network monitoring provided by Pi-hole.
What is the CORRECT way to get local hostname resolution without pihole as DHCP?
wanted to say thanks for this. Saved me a lot of headache. Had some issues with my DD-WRT seeming to not use the Static DNS setting, which allowed my ISP to hijack some DNS queries (seemed like some DNS went to pihole, some went to my ISP instead). This seems to have fixed it completely, along with me not having to redo my network settings to use PiHole’s DHCP server
@graysky2 Cheers for the info as it does feel like web pages load a like faster using this method
Is there any additional settings to change in DD-WRT? I have added:
in DD-WRT, however when I go to Pi-hole, I still get connected clients as the router, so I am unable to perform per-host tracking.
These are the three things I did to get it to work:
- Services>services>Additional DNSMasq Options: dhcp-option=6,192.168.1.100
- Setup>BasicSetup: Gateway 192.168.1.255
- Setup>BasicSetup: Local DNS 192.168.1.100
You can get the gateway and DNS from the query:
ip -4 addr show | grep global
I have been trying to get this work but Iam not having any luck. I tried disabling dhcp on dd-wrt, tried forwarding etc. I am wondering if someone who was able to make it work can post their whole main settings page of the dd-wrt router ?
Also does this work for you really? I cant seem to get that one work either, I wonder if my firware is borked with the dhcp stuff
I am running DD-WRT v3.0r36070M kongac (05/31/18) and that’s all I need to do.
dont want to hijack this thread but i feel its similar, your setup closely resembles whats describe in #2 at this link How do I configure my devices to use Pi-hole as their DNS server?
Reading the instructions from this page got me up and running quickly but…
The last thing they mention is to go into pi-hole dns settings and set the only upstream DNS IP pointing back to the router. they did not really explain why, but I would have thought this would cause a loopback issue with the router forwarding DNS to pihole and then pihole sending it back to the router bank and forth?
I am also using ddwrt and got it up and running but the new dnsmasq support 4.0 has introduced has me excited about getting getting more detailed reports from individual clients rather then them all look like they’re coming from the router itself.
Yes, I wrote that
If you set it up as shown, individual requests do indeed get logged as such. That has been the case before version 4 though.
yea i noticed that after I posted. haha.
but I was more interested in the reasoning in setting pi-holes upstream DNS as going back to the router - what does setting this way accomplish? router’s DNS -> to pi-hole and pi hole DNS -> Router
it looked like a loop to me. so this is more for furthering my understanding of networking and routing in general.
I’m also interested in understanding why the upstream in Pi-hole should be set to the router. Does that mean the router’s DNS servers should be set to whatever we would’ve set to the upstream in ph (ex: Cloudflare)?
It seems that this is creating a lot of hops for allowed lookups:
Client -> Pi-hole -> Router -> Upstream
I describe this particular setup so allow for the items listed in this post. WIthout that setup in my experience, they are not possible.
The DNS in the router can be set to whatever you wish, your ISP’s, quad9, cloudfare, etc.
I cannot comment on the hops but I can tell you that in my testing with
dig using the setup, I measure times in the low double digit msec.
I am very new to Pi Hole Set-up. I have set-up but there is one thing I am not sure about if I am doing it correctly. Because when I use
dhcp-option=6,192.168.1.2 which is my Pi Hole IP, then do I still need to set DNS Server 1 to 192.168.1.2 under LAN in the router? Or it does not matter? I kept DNS Server 1 to 192.168.1.1 (my router IP) and set
dhcp-option=6,192.168.1.2 in router dnsmasq. In PI Hole I set my upstream to Custom 192.168.1.1, as suggested in guide, it did not block any ads. The query did not go up when I visited sites. So my question is when
dhcp-option=6,192.168.1.2 is defined, do I still set DNS Server 1 to 192.168.1.2 in LAN in router? Thanks in advance.
The answer to your question was written in the original post:
I understand this bit but I think the issue, or one can say my confusion is, before setting up Pi Hole I was using dnsmasq for custom domains, for example address=/test.lan/192.168.1.10. The LAN DNS field was set to 192.168.1.1. Now following this method I just add dhcp-option=6,192.168.1.2 in my dnsmasq and I do not touch or change anything in LAN DNS field (that is, it remains 192.168.1.1). My WAN DNS are Google’s. Pi Hole is using Custom DNS for upstream pointed to 192.168.1.1 (my router). With this set-up DNS works okay, internet is fine. But nothing logged in Pi Hole. The query count does not go up when I visit sites and ads are not blocked. However, when I change my LAN DNS in router to 192.168.1.2 (my Pi Hole IP) then Pi Hole starts ad blocking. So the confusion is if I were to use dhcp-option=6,192.168.1.2 option only then why it does not work when I do not change LAN DNS. Is it correct to have LAN DNS to 192.168.1.2 and dhcp-option=6,192.168.1.2 at the same time 'cos that seems to work. Sorry - OP suggestion is very simple but somehow I did not get correct results. Thanks in advance.
Okay, I seem to have solved my issue - or looks like solved unless something pops up later incorrect. I removed the 192.168.1.1 entry under LAN DNS Server 1 and left it blank. I assume by default it is blank as well - I only input 192.168.1.1 for LAN DNS Server 1 in the past following a guide to setup dnsmasq manually. So far after removing this entry the Pi Hole is now seeing the queries and client DNS shows Pi Hole IP as DNS as defined in dnsmasq. For my other uses of dnsmasq, I guess it does not make difference whether I inout 192.168.1.1 in LAN DNS Server 1 cos I assume dnsmasq manual entries will function anyway. Thanks.