Pi-Hole contacted directly for DNS, but DD-WRT backup?

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Goto page 1, 2  Next
Author Message
Pow
DD-WRT User


Joined: 08 Jun 2006
Posts: 134
Location: PA, USA

PostPosted: Mon Jan 24, 2022 23:26    Post subject: Pi-Hole contacted directly for DNS, but DD-WRT backup? Reply with quote
EDIT: SOLVED. See https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=1256877#1256877


I don't know if what I'm looking to do is possible. I've read the Pi-Hole sticky post and a number of other Pi-Hole related posts but am not finding a solution.

If I set up my DNS as described in sticky example 1, clients then hit the Pi-Hole directly for DNS and I can see them in the Pi-Hole logs. This allows easy troubleshooting if I've got something that I think the Pi-Hole is blocking as I can filter records to just the testing client. Problem with this is local hosts that get DHCP from DD-WRT no longer resolve by host name.

If I set up my DNS as described in sticky exmaple 2, local host names do resolve and the clients do still ultimately use the Pi-Hole for DNS, but by the proxy of DD-WRT. As such all Pi-Hole log entries show as coming from DD-WRT as the host, making troubleshooting/tracking of Pi-Hole use difficult.

Is there a way to get the best of both worlds? Where clients would hit the Pi-Hole directly for DNS but local host names would still resolve? Is there something obvious I'm missing? Is there something advanced that I just don't know of/how to use that can solve this?


Last edited by Pow on Sun Jan 30, 2022 19:21; edited 1 time in total
Sponsor
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 9157

PostPosted: Tue Jan 25, 2022 0:02    Post subject: Reply with quote
I don't use pihole, so I don't know if this is possible. But if it's like DNSMasq, perhaps it's capable of forwarding DNS requests to a specific domain to another DNS server.

server=/<your-local-domain>/192.168.1.1

If it did, then using example #1 would provide the best of both worlds.

_________________
ddwrt-ovpn-split-basic.sh (UPDATED!) * ddwrt-ovpn-split-advanced.sh (UPDATED!) * ddwrt-ovpn-client-killswitch.sh * ddwrt-ovpn-client-watchdog.sh * ddwrt-ovpn-remote-access.sh * ddwrt-ovpn-client-backup.sh * ddwrt-mount-usb-drives.sh * ddwrt-blacklist-domains.sh * ddwrt-wol-port-forward.sh * ddwrt-dns-monitor.sh (NEW!)
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 3002
Location: Germany

PostPosted: Tue Jan 25, 2022 9:19    Post subject: Re: Pi-Hole contacted directly for DNS, but DD-WRT backup? Reply with quote
Pow wrote:

If I set up my DNS as described in sticky example 1, clients then hit the Pi-Hole directly for DNS and I can see them in the Pi-Hole logs. This allows easy troubleshooting if I've got something that I think the Pi-Hole is blocking as I can filter records to just the testing client. Problem with this is local hosts that get DHCP from DD-WRT no longer resolve by host name


Local DNS entries can also be added directly in the Pi-Hole. (of course this only makes sense for static addresses)

See screenshot

with regard to the 2nd example...
Well, actually it doesn't make the pi-hole usage more difficult - and strictly speaking the sorting by individual clients is just a nice gimmick - once the pi-hole is set up it runs in the background.
Here sometimes weeks and months go by without me opening the WebIF.


Last edited by ho1Aetoo on Tue Jan 25, 2022 14:18; edited 1 time in total
foz111
DD-WRT Guru


Joined: 01 Oct 2017
Posts: 707
Location: Earth

PostPosted: Tue Jan 25, 2022 13:41    Post subject: Reply with quote
Is there a way to get the best of both worlds? Where clients would hit the Pi-Hole directly for DNS but local host names would still resolve? Is there something obvious I'm missing? Is there something advanced that I just don't know of/how to use that can solve this?

I have this configuration and use local domains in pi with DHCP running on router, i am pretty sure i had to add the below example
Code:
address=/samsungprinter.lan/192.168.x.x

into my dnsmasq.custom file on router and use http in browser http://samsungprinter.lan
as well as entering them into the pi local dns records
i am no expert hope this helps

_________________
Netgear R7800 PPPoE Main Router
Network IPV4 - Isolated Vlan's with IoT Devices. Unifi AC-Pro x 3 AP's, Router Wi-Fi Disabled. OVPN Server With Paid Commercial Wireguard Client's. Gateway Mode, DNSMasq, Static Leases & DHCP, Pi-Hole DNS & Running Unbound.

No one can build you the bridge on which you, and only you, must cross the river of life!
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 3002
Location: Germany

PostPosted: Tue Jan 25, 2022 14:01    Post subject: Reply with quote
If the dnsmasq of the router is not used for DNS like in example 1 then you don't have to enter anything on the router.

And in example 2, local DNS addresses are resolved correctly anyway.
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 9157

PostPosted: Tue Jan 25, 2022 15:49    Post subject: Reply with quote
foz111 wrote:
Is there a way to get the best of both worlds? Where clients would hit the Pi-Hole directly for DNS but local host names would still resolve? Is there something obvious I'm missing? Is there something advanced that I just don't know of/how to use that can solve this?


Did you see my post above?

Maybe my suggestion isn't possible, but you never indicated one way or the other whether you even investigated it. You just asked the same question again.

_________________
ddwrt-ovpn-split-basic.sh (UPDATED!) * ddwrt-ovpn-split-advanced.sh (UPDATED!) * ddwrt-ovpn-client-killswitch.sh * ddwrt-ovpn-client-watchdog.sh * ddwrt-ovpn-remote-access.sh * ddwrt-ovpn-client-backup.sh * ddwrt-mount-usb-drives.sh * ddwrt-blacklist-domains.sh * ddwrt-wol-port-forward.sh * ddwrt-dns-monitor.sh (NEW!)
foz111
DD-WRT Guru


Joined: 01 Oct 2017
Posts: 707
Location: Earth

PostPosted: Tue Jan 25, 2022 17:44    Post subject: Reply with quote
i only had a quick look at thread didn't read it all (mybad), i was at work, i had the same issue as the OP originally, i am sure i had to add e.g address=/samsungprinter.lan/192.168.x.x to dnsmasq.custom and it worked, (and it didn't prior to adding), obviously with the entries in the pi as well but i will check when i am home, it just works i never touch it. lol
it may not require this adding, i did state i am not an expert just trying to help. if this info is wrong i apologise, i always update this file but it may not be required. if required i will test your option eibgrad and confirm.

_________________
Netgear R7800 PPPoE Main Router
Network IPV4 - Isolated Vlan's with IoT Devices. Unifi AC-Pro x 3 AP's, Router Wi-Fi Disabled. OVPN Server With Paid Commercial Wireguard Client's. Gateway Mode, DNSMasq, Static Leases & DHCP, Pi-Hole DNS & Running Unbound.

No one can build you the bridge on which you, and only you, must cross the river of life!
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 9157

PostPosted: Tue Jan 25, 2022 18:01    Post subject: Reply with quote
Whether you need to add address directives to create DNS records for some of your devices in DNSMasq is a separate issue than how to gain access to those DNS records when you've reconfigured all your LAN clients to use the pihole exclusively.

If we assume you decide to add those DNS records to DNSMasq, then that was the point of my suggestion. I'm wondering if (like DNSMasq) the pihole has the ability to direct references to the router's domain (e.g., lan) back to DNSMasq for resolution.

The other option (obviously) is to define all your DNS records on the pihole. But that will NOT provide you with any information regarding DHCP clients that have no such DNS records.

On a side note, I find the host-record directive to be superior to the address directive for creating DNS records in DNSMasq. The former also supports reverse lookups (i.e., the ability to provide an IP address and have it report the hostname). That can come in handy sometimes.

Code:
host-record=mypc,192.168.1.100


Also, whenever I created address or host-record directives, I always include the hostname *and* fully-qualified hostname.

Code:
host-record=mypc,mypc.lan,192.168.100


Remember, I'm only referring to DNSMasq here. I have no clue what the pihole requires or supports in terms of configuration options.

_________________
ddwrt-ovpn-split-basic.sh (UPDATED!) * ddwrt-ovpn-split-advanced.sh (UPDATED!) * ddwrt-ovpn-client-killswitch.sh * ddwrt-ovpn-client-watchdog.sh * ddwrt-ovpn-remote-access.sh * ddwrt-ovpn-client-backup.sh * ddwrt-mount-usb-drives.sh * ddwrt-blacklist-domains.sh * ddwrt-wol-port-forward.sh * ddwrt-dns-monitor.sh (NEW!)
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 3002
Location: Germany

PostPosted: Tue Jan 25, 2022 18:57    Post subject: Reply with quote
The Pi-Hole itself runs with dnsmasq or rather it is based on a dnsmasq fork called FTL (Faster-Than-Light).

You can also change the configuration files manually but many functions are available in the GUI.
foz111
DD-WRT Guru


Joined: 01 Oct 2017
Posts: 707
Location: Earth

PostPosted: Tue Jan 25, 2022 19:08    Post subject: Reply with quote
POW please ignore my previous posts adding to the dnsmasq.custom file is not required.

Tested, ho1Aetoo is correct, no entries are required in router dnsmasq file, i had to add these when i first started using my pi to get local domains to resolve, but i must have changed the configuration some time ago, it works by just entering the local domain in to the pi as ho1Aetoo said.
i have now removed my entries from dnsmasq.custom thanks ho1Aetoo this saves me a job updating that file when its not required.

_________________
Netgear R7800 PPPoE Main Router
Network IPV4 - Isolated Vlan's with IoT Devices. Unifi AC-Pro x 3 AP's, Router Wi-Fi Disabled. OVPN Server With Paid Commercial Wireguard Client's. Gateway Mode, DNSMasq, Static Leases & DHCP, Pi-Hole DNS & Running Unbound.

No one can build you the bridge on which you, and only you, must cross the river of life!
Pow
DD-WRT User


Joined: 08 Jun 2006
Posts: 134
Location: PA, USA

PostPosted: Tue Jan 25, 2022 21:57    Post subject: Reply with quote
So it looks like my best option if I want the Pi-Hole logs to be meaningful is to go with sticky thread option 1, and manually maintain DNS entries for local network hosts in the Pi-Hole? Do I have that right?

I was sort of hoping that there would be something along the lines of DD-WRT handing out the Pi-Hole IP for DNS when it assigns DHCP leases, then the Pi-Hole in addition to looking at internet servers for DNS resolution could also look to DD-WRT for local hosts if they were not found in the first lookup. Which I guess would be partially a question for the Pi-Hole community, but I'd also need to know if DD-WRT would act as a DNS server for local hosts even if it was told to point DHCP clients to the Pi-Hole.

I've been using sticky option 2 since I set up my Pi-Hole, but it would really be nice if in the Pi-Hole I could see logged domain lookup attempts by individual clients rather than everything just being my DD-WRT router address. I'm assuming I could somehow set up same DNS lookup logging within DD-WRT but why double the effort when the Pi-Hole is already doing it?

Thanks for the feedback all, it is appreciated. Heck, I'm already ahead of the game since before I opened this question I first updated DD-WRT to a more current version to make sure I wasn't missing anything. Once I did that I discovered that it now actually has a working sftp server. Something I lacked on my old version, without jumping through a few hoops first. The way I maintain reconfiguring DD-WRT after an update is simplified with this available.
foz111
DD-WRT Guru


Joined: 01 Oct 2017
Posts: 707
Location: Earth

PostPosted: Wed Jan 26, 2022 9:25    Post subject: Reply with quote
i use the 2nd method posted by ho1Aetoo using dnsmasq on router and run unbound on pi, just works never seem to need to touch it other than any updates.
i get to see hostnames in DHCP lease clients list Status>LAN.

_________________
Netgear R7800 PPPoE Main Router
Network IPV4 - Isolated Vlan's with IoT Devices. Unifi AC-Pro x 3 AP's, Router Wi-Fi Disabled. OVPN Server With Paid Commercial Wireguard Client's. Gateway Mode, DNSMasq, Static Leases & DHCP, Pi-Hole DNS & Running Unbound.

No one can build you the bridge on which you, and only you, must cross the river of life!
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 3002
Location: Germany

PostPosted: Wed Jan 26, 2022 10:17    Post subject: Reply with quote
@Pow

The variant should also work: (try it out - I have not tested)

3. example

Client <--> Pi-Hole <--> DD-WRT <--> Public DNS
(the clients get 192.168.1.110 as DNS server via DHCP)

All required settings are shown in the picture.

Additional Dnsmasq Options:

Code:
dhcp-option=br0,6,192.168.1.110


DNS rebind protection must be disabled on the Pi-Hole.(in case it was activated before)

Code:
sudo sed -i 's/^\(stop-dns-rebind\)$/#\1/' /etc/dnsmasq.d/$USER.conf


    cat /etc/dnsmasq.d/$USER.conf
    #stop-dns-rebind


Problems : does not work with ubridged / isolated VAP's
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 3002
Location: Germany

PostPosted: Sat Jan 29, 2022 13:44    Post subject: Reply with quote
no feedback?
Pow
DD-WRT User


Joined: 08 Jun 2006
Posts: 134
Location: PA, USA

PostPosted: Sat Jan 29, 2022 18:51    Post subject: Reply with quote
ho1Aetoo wrote:
no feedback?

Sorry, just saw the reply yesterday and was waiting for the weekend to try it. Just did so, and it seemed like the PiHole was having trouble getting DNS from the router, or the router wasn't relaying that out to the internet.

But I may have stumbled on something, I'm going to tinker with it. Stay tuned...
Goto page 1, 2  Next Display posts from previous:    Page 1 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum