[SOLVED] Different local DNS server, not the router!

Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware
Author Message
bl@d3runn3r
DD-WRT User


Joined: 10 Jan 2010
Posts: 210

PostPosted: Fri Sep 23, 2016 13:07    Post subject: [SOLVED] Different local DNS server, not the router! Reply with quote
Hi,

I have searched the forums without luck so i'm trying my luck here.

I have a DIR825 rev B router and i have a DNS server configured in my network that can handle all request and if not found forward it to external server, for example google.

Now i'm trying to configure this in my router that is running build DD-WRT v3.0-r30631 std (09/14/16)

So i configured it on several places just to be sure it would push this to all clients connected to my router wired or wireless without luck, it keeps returning the previous external ones (8.8.8.8, 8.8.4.4)

My configuration is like this:
Under Setup / Basic Setup:
Router IP:
Local IP: 192.168.1.1
Subnet Mask: 255.255.255.0
Gateway: 192.168.1.1
Local DNS: 192.168.1.1 <-- this i changed to the IP of the actual DNS server i would like to use 192.168.1.100

Network Address Server Settings (DHCP):
DHCP Type: Server
DHCP Server: Enabled
Static DNS 1: 8.8.8.8 <-- this i changed to the IP of the actual DNS server i would like to use 192.168.1.100 and removed the second one
Static DNS 1: 8.8.4.4

Use DNSMasq for DHCP: Enabled
Use DNSMasq for DNS: Enabled <-- If i'm correct when this is enabled it is of no use to configure the previously static DNS servers?
DHCP-Authoritative: Enabled
Forced DNS Redirection: Disabled

Under Services / Services:
DNSMasq: Enabled
Local DNS: Disabled <-- Wasn't sure if i needed to enable or disable this? I thought it would use the configured Local DNS IP given in Basic Setup under Router IP
No DNS Rebind: Enabled
Query DNS in Strict Order: Enabled
Add Requestor MAC to DNS Query: Disabled

Additional DNSMasq Options
dhcp-option=6,8.8.8.8,8.8.4.4 <-- Can not recall why i have configured this but i think it was for the HE IP6to4 tunnel, anyway i removed that when i configured my local DNS server with IP 192.168.1.100

What i would like to accomplish is that all clients connected to my router , wired or wireless will be using the DNS server that is available in my own network. But everytime i do some changes to DDWRT config and reboot router, do a ipconfig /renew or release on clients or reboot them also it still gives me the wrong DNS server.
Or it is 8.8.8.8 and 8.8.4.4 or it's given 192.168.1.1 (the router gateway IP) as DNS server(s)

I was hoping someone here could give me some tips/tricks on how to accomplish what i want?


Last edited by bl@d3runn3r on Mon Sep 26, 2016 7:39; edited 1 time in total
Sponsor
mrjcd
DD-WRT Guru


Joined: 31 Jan 2015
Posts: 6291
Location: Texas

PostPosted: Fri Sep 23, 2016 16:22    Post subject: Reply with quote
192.168.1.100 is doing local DNS but it's not the gateway to internet?
I really haven't done a conf exactly like that in ages but -

Try (on your 192.168.1.1) router main setup page
leave local DNS 0.0.0.0
set dns1 192.168.1.100
set dns2 8.8.8.8
set dns3 8.8.4.4

Forced DNS Redirection: Enabled
leave everything else as you have shown


also some new buggy stuff in GUI settings with some routers
I would telnet or ssh in --
cat /tmp/resolv.conf (see what nameserver says)
and/or look at
cat /tmp/resolv.dnsmasq

--
EDIT:
just thinking if the 192.168.100 router is already conf with good DNS servers and it's always
available then in might be better to leave -
set dns2 0.0.0.0
set dns3 0.0.0.0
or put in dummy IP that won't go anywhere
Detection
DD-WRT User


Joined: 19 Jan 2012
Posts: 403
Location: UK

PostPosted: Fri Sep 23, 2016 16:44    Post subject: Reply with quote
I have a raspberry pi running pi.hole adblocker as my DNS server, and this config works for all connected DHCP clients wired and wireless

DNS 1 = Raspberry Pi
DNS 2 and 3 are non existent IPs to ensure it either uses the Pi, or doesn't work at all, setting them all to the same IP forces ISP DNS to take control of 2&3 instead)


_________________
TPLINK TL-WR2543ND (5GHz)
WRT160NL (2.4GHz)
bl@d3runn3r
DD-WRT User


Joined: 10 Jan 2010
Posts: 210

PostPosted: Fri Sep 23, 2016 19:23    Post subject: Reply with quote
Thanks both for the input.
I'm also running a pi hole adblocker variant on my Synology
I'm using DNSMasq for DNS, no idea why I configured it but i have disabled it now and only configured my local DNS server, now lets see what happens with my VPN setup and 6to4 tunnel.

Otherwise i should change this line in Additional DNSMasq Options from: dhcp-option=6,8.8.8.8,8.8.4.4 to dhcp-option=6,192.168.1.100 (if i'm correct)

Configuring static DNS servers doesn't work when DNSmasq is enabled for DNS, am i right?

/edit:
For some reason my laptop still uses googles dns servers. Need to do some digging in conf i guess.
bl@d3runn3r
DD-WRT User


Joined: 10 Jan 2010
Posts: 210

PostPosted: Fri Sep 23, 2016 19:30    Post subject: Reply with quote
@mrjcd:

I did execute your commands given and this is the output:
root@DIR825:~# cat /tmp/resolv.conf
search dynamic.ziggo.nl
nameserver 192.168.1.1
root@DIR825:~# cat /tmp/resolv.dnsmasq
nameserver 192.168.1.1
nameserver 192.168.1.125
nameserver 89.101.251.229
root@DIR825:~#

Seems legit but why does Win7 still saying 8.8.8.8 as server?

C:\Users\laptop>nslookup google.com
Server: google-public-dns-a.google.com
Address: 8.8.8.8

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


Last edited by bl@d3runn3r on Sat Sep 24, 2016 8:34; edited 1 time in total
Detection
DD-WRT User


Joined: 19 Jan 2012
Posts: 403
Location: UK

PostPosted: Sat Sep 24, 2016 8:22    Post subject: Reply with quote
C:\WINDOWS\system32>nslookup google.com
Server: raspberrypi
Address: 192.168.1.105

Non-authoritative answer:
Name: google.com
Addresses: 2a00:1450:4009:80b::200e
216.58.201.46

-----
Not sure if that will give any clues, I have GoogleDNS set in the Pi

--
Any reason you have Additional DNSMasq Options set to anything at all?

Can't you just set it up like my screen above, and set DNS1 as local and DNS 2&3 as GoogleDNS?

If Local fails, it will drop to Googles


_________________
TPLINK TL-WR2543ND (5GHz)
WRT160NL (2.4GHz)
nullnothere
DD-WRT Novice


Joined: 27 Jul 2016
Posts: 15

PostPosted: Mon Sep 26, 2016 5:59    Post subject: Re: Different local DNS server, not the router! Reply with quote
Hi @bl@d3runn3r,

From what I understand, you are trying to have your DHCP clients use a *different* DNS server than the router itself.

Usually in typical setups, the router itself is also the DNS server (which forwards dns queries upstream to the configured ISP/Google (etc) public DNS servers).

If you want to override this and have something like this:

a) router is 192.168.1.1 (and has everything configured as usual for DNS etc. from settings based on your ISP/Google).

b) separate super-dns-server is 192.168.1.101 (example).

c) All DHCP clients should use DNS server as 192.168.1.101 instead of 192.168.1.1 (or public DNSs).

Here's what you need to do:

1. Enable dnsmasq (etc.)

2. As a backup, ensure that the router is setup correctly for DNS via ISP and/or Google (etc.) - this way if you use 192.168.1.1 as the DNS everything works correctly at a minimum.

3. Enable the advanced dnsmasq configuration options and add:

--dhcp-option=6,192.168.1.101

What this does is setups dnsmasq to advertise the DNS Server to your LAN as 192.168.1.101.

There are lots of other configurations also possible (like changing router etc.)

See: http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html (search for dhcp-option). Also run "dnsmasq --help dhcp" from a desktop version of dnsmasq to get the full options available.

HTH.

P.S: change the IPs to suit your needs.

P.P.S: Edited typo of dhcp-option=3,192.168.1.101 to dhcp-option=6,192.168.1.101

P.P.P.S: You've tried something similar but can you try again with these specific options and report if things work.


Last edited by nullnothere on Mon Sep 26, 2016 6:55; edited 1 time in total
<Kong>
DD-WRT Guru


Joined: 15 Dec 2010
Posts: 4339
Location: Germany

PostPosted: Mon Sep 26, 2016 6:45    Post subject: Reply with quote
By the way local DNS + DNSMasq only works if you have disabled "No DNS Rebind", otherwise DNSMasq will reject the local DNS as this is a security feature to prevent from certain attacks.
_________________
KONG PB's: http://www.desipro.de/ddwrt/
KONG Info: http://tips.desipro.de/
bl@d3runn3r
DD-WRT User


Joined: 10 Jan 2010
Posts: 210

PostPosted: Mon Sep 26, 2016 7:31    Post subject: Reply with quote
@nullnothere

Thank you, it worked!

I think in my previous attempts i enabled/disabled to much i guess to get this working.
The last comment from @<Kong> was that little push i think to get things working as wanted Wink

Thanks all for your input Wink
feedmebits
DD-WRT Novice


Joined: 08 May 2016
Posts: 7

PostPosted: Mon Jan 16, 2017 22:47    Post subject: Reply with quote
just wanted to say thank you for this post. Have been playing with quite a few settings to have my router give my clients a different dns server. The info in this post worked for me too Smile
McFrisch
DD-WRT Novice


Joined: 03 Apr 2014
Posts: 4

PostPosted: Wed Mar 28, 2018 4:09    Post subject: Just to reiterate... Reply with quote
Thanks for the advice! To illustrate what worked for me, based on your suggestions, here are 2 screenshots. I am running Firmware: DD-WRT v3.0-r35531 std (03/26/18 ) on a Linkysy WRT 1200ac v2.
DeLoVaN
DD-WRT Novice


Joined: 14 Feb 2022
Posts: 1

PostPosted: Mon Feb 14, 2022 14:10    Post subject: Reply with quote
For information, I had to specify:

Quote:
dhcp-option=6,192.168.1.101


instead of

Quote:
--dhcp-option=6,192.168.1.101


Otherwise, DNSMasq will fail to start.


Additionnaly, No DNS Rebind is still enabled and does not produce any error in my config.
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 3005
Location: Germany

PostPosted: Mon Feb 14, 2022 14:21    Post subject: Reply with quote
The thread is 6-7 years old and outdated and there is a lot of nonsense here.

If you want the configured static DNS server to be sent to the clients via DHCP instead of the IP address of the router, then it is also sufficient to deactivate "use dnsmasq for DNS".

You don't need any "additional dnsmasq configurations" for this at all.
Captain351
DD-WRT Novice


Joined: 09 Feb 2013
Posts: 1

PostPosted: Sat Dec 03, 2022 0:00    Post subject: Works Great but what about secondary dns? Reply with quote
Works Great but what about secondary dns?

It works but there no 2nd or 3rd dns servers. Is there another option to add that as well?
ho1Aetoo
DD-WRT Guru


Joined: 19 Feb 2019
Posts: 3005
Location: Germany

PostPosted: Sat Dec 03, 2022 8:55    Post subject: Reply with quote
If you have read my previous post then the question would be unnecessary.
Because in the GUI you can configure 3 static servers.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware 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