10

I have a DD-WRT (using DD-WRT v24SP2-MULTI (03/21/11) std) router set up with DNSMasq to resolve certain domains to internal addresses and pass everything else thru. The router itself is configured to use Google’s public DNS servers to resolve addresses.

My setup screen looks like this:

DDWRT Setup Screen

My problem is that when a DHCP client connects, they get the router plus Google’s two DNS servers as the assigned DNS servers:

DNS servers assigned by DHCP

This is a problem because sometimes wireless clients try to resolve a domain that is supposed to point to an internal IP address and end up getting an external ip instead because for whatever reason their request is sent to 8.8.8.8 instead of to the router.

I don’t want the router to serve anything but its own IP as the DNS server. Is that possible?

9
  • 1
    I may be mistaken, but since that is the DHCP server configuration section you are explicitly telling your router to provide those google servers as dns options for clients. You want to remove those from the list, and then configure the router to get its own dns from google, perhaps the answer below is the proper way to do this.
    – horatio
    Jan 24, 2012 at 15:47
  • If I remove those, the router will provide the servers that it got from the ISP via DHCP..
    – 0x6A75616E
    Jan 29, 2012 at 17:30
  • You say "for whatever reason" sevral times in your post and comments. THIS is the reason that 8.8.8.8 is passed to the clients. Because you told it to. If you don't want that reported, you need to remove it. If your router is a dns server, then try your router's address ONLY.
    – horatio
    Jan 31, 2012 at 14:58
  • @horatio, not really.. My point is why is the dhcp server giving out any additional DNS addresses at all. If dnsmasq on the device and applying certain name resolution rules, serving additional DNS servers (besides the router itself) defeats that purpose.
    – 0x6A75616E
    Feb 1, 2012 at 4:46
  • That section is a list of DNS servers to be given out to clients which request DHCP information.
    – horatio
    Feb 1, 2012 at 15:09

8 Answers 8

7

It's good that you're using DNSMasq.

You can configure what you want in the Services (> Services) tab, in the DNSMasq > Additional DNSMasq Options box, but first, you'll want to clear those Static DNS fields. Static DNS fields in "Setup > Basic Setup"

Add the following to the DNSMasq options box:

dhcp-option= option:dns-server, 192.168.10.10 # DHCP option 006

server = 8.8.8.8 # DNSMasq will use these servers for forwarding the DNS requests that it can't serve
server = 8.8.4.4
3
  • This seems to have worked perfectly for myself. Very dumb question though. Which part of that first line specifies DHCP option 006? option:dns-server? Dec 29, 2016 at 16:47
  • @Residualfail: Yep; I think you can specify it numerically as well, but option:dns-server corresponds to DHCP option 006.
    – palswim
    Dec 29, 2016 at 20:25
  • 1
    Seems I might've spoken too soon. It doesn't look like dns is falling back to Google's dns after my internal dns is shutdown. =( Dec 29, 2016 at 21:42
4

I am not using DDWRT, so this is half-question / half-answer.

The manual DNSMasq as DHCP server says in the section "Extra DNSMasq options" :

There are some extra options in the web interface for DNSMasq that you can set by entering them in Additional DNSMasq Options on the "Services" tab.

If you wish to pass through the DNS servers from your ISP, you can use the following parameters:

dhcp-option=6, x.x.x.x, y.y.y.y

where x.x.x.x = DNS1 y.y.y.y = DNS2

This seems to mean that passing the ISP servers is optional, so locating and deleting the above line should turn it off.

3
  • 2
    I would set dhcp-option=6,192.168.10.10 to pass that IP address as DNS server IP to DHCP clients.
    – thane
    Jan 25, 2012 at 7:25
  • 1
    Thanks for the pointer. I tried that on both uDHCPd (which is the DNS daemon I was using on ddwrt) and DNSMasq (switched to it) but to no avail :(. It keeps serving the additional dns records for whatever reason.
    – 0x6A75616E
    Jan 25, 2012 at 16:24
  • In that case you should maybe post the question on the DD-WRT forums.
    – harrymc
    Jan 25, 2012 at 18:38
4

Info taken from the official DD-WRT site: http://www.dd-wrt.com/wiki/index.php/OpenDNS

It appears you can set the remaining dns servers to non-routable IPs (in my case 10.0.0.0 & 10.0.0.1) and it will squeeze out your ISPs DNS servers with these non-routables. So far for me it seems to be working without any delay waiting on the non-existent DNS servers.

1
  • There won't be a delay, because non-routable addresses will get dropped by the network stack immediately. It creates a minor amount of overhead and is a hack, but there should be no real world problems.
    – Mantriur
    Mar 6, 2016 at 16:30
3

A typical configuration option for DD-WRT is to allow the router to route DNS outside of the ISP's primary DNS servers; which you have succesfully done; however, since the requests are generating from the CLIENT machine, connecting TOO the router, the order of preference is always given to the configured DNS on the client's machine, and then to the router.

What you are describing happening is that the client is associating with your router, which is correct, but their DNS shows your router IP + 2 other DNS settings. Please check the client computer, and make sure that their IPV4 settings are set to dynamically pull the DNS server configuration from the connection, and not manually configure it:

Configuring Client

Then, make sure you have your DD-WRT router setup properly:

Configure Router

In your configuration above, you also have some issues; you have set the DHCP address range to start at 200 and end at 255; I would recommend you change that to start at 200 and end at 254; leaving the 255 address off, given that for normal configurations *.*.*.255 is a broadcast address, and not a normal IP address to use to assign to the associated client.

I highlighted the local DNS settings because you set yours to 127.0.0.1; which means you are running a local DNS server on the router. If this isn't the case, then change it to 0.0.0.0, or a proper address to a local DNS server on your network.

You'll notice that when the server & client are configured in this manner, only the routers DNS IP address will appear; and all requests will be routed through the DNS servers associated w/ the router.

Note on local DNS server If you wish the router to associate certain local address to local IP's you can add those to the DNSMasq configuration options in the proper DD-WRT screen, or use a local DNS server, and put in a proper IP address for that server (usually a static server, within the scope of the network). This way, the order of resolution will be the local server first, then the 2 external. But, still only the clients will see the router IP as the DNS server.

1
  • thanks for your answer!, I've made sure all of the clients on the network don't have DNS servers hard coded. In fact, in every case 192.168.10.10 (the router itself) comes back as the first DNS server to hit. What happens is that some computers randomly hit the secondary DNS servers that DHCP is currently providing.. I've tried a million things and it just looks like there's no way to have it only serve itself. I might end up running some other dnsmasq instances on a different machine and use it as dns2 and dns3.. such a hack! lol. thx again.
    – 0x6A75616E
    Feb 1, 2012 at 4:52
2

If you do not want clients to reach external DNS do not put their addresses in your DHCP server config.

I suppose you wanted to add (eventually faster) google's DNS servers in a configuration of external DHCP Client (where DNSMASQ would take it's DNS client preferences)

Extra:

You have to add extra (all) DNS servers to WAN link configuration. DNSMasq will use them and never ones DHCP client would acquire from provider.

1
  • thanks for your contribution, but that doesn't make much sense in the context of the question. DNSMasq works by forwarding dns requests from clients to real DNS servers with the ability to modify some responses on the fly. If I removed the dns servers from the config, the router just reverts to the ISP-assigned servers. You're answering my question by saying "fix your configuration" but the question itself is "how to fix the configuration".
    – 0x6A75616E
    Jan 27, 2012 at 15:03
2

I've been having a similar problem after my router died and I've needed to get a flashed WRT160N running.

I have a box functioning as a local DNS server on 192.168.2.30 in my network. I basically want DHCP to only give out that address as a DNS server; I don't want DNS going anywhere else.

I'm using "Firmware: DD-WRT v24-sp2 (12/19/10) mini"

Doesn't seem to matter what combination of DNSMasq settings, DHCP settings, Local DNS, or whatever I use. If DNS Server 2 and DNS Server 3 are blank or match DNS Server 1, DD-WRT insists on handing out Comcast's DNS servers for those spots. I don't want this as I have 192.168.2.30 forwarding to OpenDNS for queries that aren't local.

I'm writing this off as a bug in this rather old (by now) version of DD-WRT and am going to be installling/configuring my own DHCP server on 192.168.2.30 and disabling DHCP on the router.

2
  • 1
    that's actually not a bad idea... I might just set up dhcp on another box and quit screwing around with ddwrt.
    – 0x6A75616E
    May 28, 2012 at 15:16
  • 1
    This problem still exists in my Feb 2016 build, seems to be a feature. I'm ditching the router and am going to back to a Linux PC for this. People building router software should really have a better understanding of the privacy issues that come with this unexpected, uncommon, and irresponsible behavior of the GUI. If I have to hack stuff together myself, there's really no point in using a comparatively complicated and limited system. And when you're running DNS and DHCP already on another machine, what's left for the router? Packet pushing?
    – Mantriur
    Mar 6, 2016 at 16:21
1

Added a few years late because I stumbled upon this searching for an answer... I added virtual interfaces to my pi-hole to handle 2 more ip addresses.

eth0 192.168.10.10
eth0.1 192.168.10.11
eth0.2 192.168.10.12

This allowed me to populate all 3 boxes with local addresses, and have it hand out enough that even though the dd-wrt router is handing out 5, 3 local and the 2 upstream ISP dns, my machines won't hit them.

0

Chiming in with a less hacky method: If it's your LAN and your DNS, I'm sure there are some addresses to spare for having the DNS listen on three IPs.

The gain over having non-routable addresses should be irrelevant in practive, but at least you're not relying on something being broken and the routers response to it. You can never be sure if that won't change some day.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .