DDWRT with Local DNS + optional Pi-Hole

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
zerobyzero
DD-WRT Novice


Joined: 23 Jul 2021
Posts: 2

PostPosted: Fri Jul 23, 2021 20:40    Post subject: DDWRT with Local DNS + optional Pi-Hole Reply with quote
Good evenening

I've been scratching my head for a while with a problem that *should* be easy to solve but somehow it's getting more and more absurd.

My main goal is to setup the DDWRT router as the main DNS for my LAN using DNSMasq (this is covered in many tutorials), and setting Pi-Hole as my secondary or optional DNS for my LAN. Apologies if there is any obvious tutorial explaining this but everything I've found uses Pi-Hole as the only DNS in the LAN.

The main reason behind this approach is I want to have the really important domain names in the router which will be always available, and leave the less important domains for the Pi-Hole which won't be active as frequently.

I'm using DD-WRT v3.0-r30796 std (10/25/16).


Pi-Hole machine is off...

In my DDWRT configuration I pretty much have:

Code:
Local DNS = 0.0.0.0
Static DNS1 = 192.168.2.158 <= the IP of my Pi-Hole
Static DNS2 = 8.8.8.8
Static DNS3 = 8.8.4.4


So far, my Pi-Hole is a regular DNS, nothing special about it.

In order to resolve my lan names (which will be .lan), I do:

Code:
Use DNSMasq for DHCP YES
Use DNSMasq for DNS  YES
(all other options, disabled)


The options for DNSMasq are as following:

Code:
DNSMasq                        ENABLED
Local DNS                      DISABLED
No DNS Rebind                  DISABLED
Query DNS in Strict Order      ENABLED
Add Requestor MAC to DNS Query DISABLED


In the extra options for DNSMasq I have:

Code:
local=/lan/
address=/router.lan/192.168.2.1


If I do a nslookup for google.com and router.lan I get...

Code:
$ nslookup google.com 192.168.2.1
Server:      192.168.2.1
Address:   192.168.2.1#53

Non-authoritative answer:
Name:   google.com
Address: 142.250.187.238


Code:
$ nslookup router.lan 192.168.2.1
Server:      192.168.2.1
Address:   192.168.2.1#53

Name:   router.lan
Address: 192.168.2.1


Brilliant, both LAN and external names resolve and I can ping both. Everything fine so far, right?


The crazy part, turning on the Pi-Hole machine...


Let's turn on the Pi-Hole, define in it the name router.local=192.168.2.1. And do the nslookups for router.lan and router.local:

Code:
$ nslookup router.lan 192.168.2.1
Server:      192.168.2.1
Address:   192.168.2.1#53

Name:   router.lan
Address: 192.168.2.1



Code:
$ nslookup router.local 192.168.2.1
Server:      192.168.2.1
Address:   192.168.2.1#53

Name:   router.local
Address: 192.168.2.1


OK, both seem to work fine, identical output, which was expected. Next test... ping:

Code:
$ ping router.lan
PING router.lan (192.168.2.1) 56(84) bytes of data.
64 bytes from ddwrt.lan (192.168.2.1): icmp_seq=1 ttl=64 time=0.682 ms
64 bytes from ddwrt.lan (192.168.2.1): icmp_seq=2 ttl=64 time=4.93 ms


Code:
$ ping router.local
ping: unknown host router.local


What!? Having reached this point, I'm afraid I don't understand anything and the more I read the more confused I get because this problem shouldn't happen.


If you read until here, many thanks, this is a too long post, I know. Do you have any idea or feeling of what could be wrong?

Regards
Sponsor
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14125
Location: Texas, USA

PostPosted: Fri Jul 23, 2021 20:52    Post subject: Reply with quote
1) on what router
2) upgrade to a release from *this* year
because
3) that build is old, deprecated, and has known vulnerabilities

_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
zerobyzero
DD-WRT Novice


Joined: 23 Jul 2021
Posts: 2

PostPosted: Fri Jul 23, 2021 21:15    Post subject: Reply with quote
1. It's a Linksys WRT1900ACS
2. Just updated to DD-WRT v3.0-r44715 std (11/03/20), many thanks for the advice!

Didn't reset the configuration to default but now nslookup is not resolving. I'll continue reading and playing with the new options I see.

Regards

EDIT: Interesting... if I create a new name in the Pi-Hole called router.here, it works for nslookup and also ping. So, there must be something in the router blocking .local domains?
kernel-panic69
DD-WRT Guru


Joined: 08 May 2018
Posts: 14125
Location: Texas, USA

PostPosted: Fri Jul 23, 2021 21:54    Post subject: Reply with quote
And you zeroed in on the router database instead of the download server link I provided. There is a sticky in the forum about using Pi-Hole with DD-WRT. There is also a wiki about using DNSMasq as DHCP server. If you are going to use local DNS, you have to specify a server...

Please take a moment or five to read the forum rules and guidelines while you are at it.

_________________
"Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT
Pogo - A minimal level of ability is expected and needed...
DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)

----------------------
Linux User #377467 counter.li.org / linuxcounter.net
mwchang
DD-WRT Guru


Joined: 26 Mar 2013
Posts: 1855
Location: Hung Hom, Hong Kong

PostPosted: Sat Jul 24, 2021 13:29    Post subject: Re: DDWRT with Local DNS + optional Pi-Hole Reply with quote
zerobyzero wrote:
My main goal is to setup the DDWRT router as the main DNS for my LAN using DNSMasq (this is covered in many tutorials), and setting Pi-Hole as my secondary or optional DNS for my LAN. Apologies if there is any obvious tutorial explaining this but everything I've found uses Pi-Hole as the only DNS in the LAN.

The main reason behind this approach is I want to have the really important domain names in the router which will be always available, and leave the less important domains for the Pi-Hole which won't be active as frequently.


You can just use DNSmasq to do it without the Pi. Use the textbox in Services -> DNSmasq -> Addtional DNSmasq Options to store local DNS table. I think the option is "address=".

DNSMasq Local Network - DD-WRT Wiki
https://wiki.dd-wrt.com/wiki/index.php/DNSMasq_-_DNS_for_your_local_network_-_HOWTO

Use dnsmasq to provide DNS & DHCP services - Fedora Magazine
https://fedoramagazine.org/dnsmasq-provide-dns-dhcp-services/

Create a Home Network DNS Server Using DNSMasq
https://stevessmarthomeguide.com/home-network-dns-dnsmasq/

Create your own local domain and DHCP with dnsmasq
https://thinkingeek.com/2020/06/06/local-domain-and-dhcp-with-dnsmasq/

domain name system - Setting up dnsmasq for a local network - Server Fault
https://serverfault.com/questions/136332/setting-up-dnsmasq-for-a-local-network

When you are more experienced, enable and use recursive DNS Unbound to host a local domain with both forward and reverse look-up! And you can have multiple domains! It's more secured than DNSmasq as well.

I think Pi Hole should do something more CPU intensive, as for example, MySQL. Smile


_________________
Router: Asus RT-N18U (rev. A1)

Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!

Facebook: https://www.facebook.com/changmanwai
Website: https://sites.google.com/site/changmw
SETI@Home profile: http://setiathome.berkeley.edu/view_profile.php?userid=211832
GitHub: https://github.com/changmw/changmw
Display posts from previous:    Page 1 of 1
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