How to get PiHole working with OpenWrt?

Hi I am trying to get my PiHole to work with OpenWrt. Where do I put the dns address of my pi in Openwrt. All the links I have bin reading on google are saying different things.


My PiHole is at 192.168.1.150 so in Network -> Interfaces -> LAN -> Advanced Settings -> DHCP-Options I put 6,192.168.1.150
After saving I cant get any DNS on any of my devices. Then I tried putting my PiHoles address under the DNS server for lan same thing. Then I tried under wan after unticking the box for Use DNS servers advertised by peer Same thing!

What's the rite way to set this up pleas. Plus can some one pleas give me the rite firewall rules to make all DNS go to my PiHole? Thanks Tapper. If any one has the time this would make a good post for the wiki. Extra info my router is the WRT3200acm and I tried all this with a fresh install of openwrt.

1 Like

I don't use Pi-Hole, but you might try Network > Interfaces > Wan > Advanced Settings > Uncheck Use DNS servers advertised by peer > Put DNS in Use Custom DNS servers > Leave out the 6, just enter 192.168.1.150, see if that works (don't know the firewall rules unfortunately).

2 Likes

I do as above for ipv4 and ipv6 which works for me, only thing i add is a custom firewall rules via iptables to block my Fire Cube using Google dns

1 Like

I now use Pihole as my DHCP server, For me that was the easiest way.

I have used OpenWrt as the DHCP server and you are correct you need "option 6" in the advanced settings, Try rebooting the router and all your devices after setting this or you will have to wait until your DHCP reservations time out which I'm not sure the default but I think it's 24 hours.

1 Like

That's the correct way, it works for me!

That way all DHCP clients will get your PiHole as DNS server. If your client has a static IP, you must add the IP of your PiHole server in client's /etc/resolv.conf.

2 Likes

Restart all your devices.

2 Likes

Following this method causes all name resolution to fail on my network.
Even for static IP hosts with explicit DNS references!?!?

I really don't know what's going on. If I specify my DNS server without changing the DHCP advertisement in the Advanced DHCP options it works as expected but I cannot seem to provide this DNS resolver to my DHCP clients...

Anyone know what I can do?
I'm using OpenWrt 18.06.1

However...
Adding my server to DNS forwardings in Network > DHCP and DNS > General Settings seems to work.

Edit: but only briefly before reverting to upstream resolution :frowning: