I am using dd-wrt (r23503, for the record) on my new Asus RT-AC56U router. Unfortunately, dnsmasq configuration is giving me nothing but headaches. Here's what I want:
- DNS queries from the LAN/WLAN for hosts on the LAN/WLAN should be answered for both short names and FQDNs.
- Since some of the devices are portable (like my phone), I need host.mydyndomain.net to resolve to a LAN IP when connected to the LAN and to the external IP when queried from outside the LAN.
But here is what I currently get:
- Queries for DHCP leased hosts are being correctly returned (dd-wrt's "Local DNS" option for dnsmasq).
- Queries to any random non-existant host incorrectly return the external WAN IP address. So, "nslookup foobarbaz" gives a result when it should return an error.
As for my hosts with static IPs, I have not yet found an adequate solution. I read through the dnsmasq manpage and from what I can tell, the correct choice is the "host-record" option.
The dnsmasq related configuration in dd-wrt (under the Services tab) is:
"DHCP Server" section:
Used domain: WAN
LAN domain: [blank]
Additional DHCPd Options: [blank]
One static lease defined.
Local DNS: enabled
No DNS Rebind: enabled
Additional DNSMasq Options:
[several more host-record entries for the other hosts with static LAN IPs]
Unfortunately, putting these host-record lines in the additional options box seems to completely break dnsmasq and then nothing can connect to the LAN/WLAN via DHCP. Once I empty the contents of the box then DHCP starts working again.
My dnsmasq.conf file is as follows:
interface=br0 resolv-file=/tmp/resolv.dnsmasq all-servers domain=mydyndomain.net dhcp-leasefile=/tmp/dnsmasq.leases dhcp-lease-max=51 dhcp-option=lan,3,192.168.1.1 dhcp-authoritative dhcp-range=lan,192.168.1.100,192.168.1.149,255.255.255.0,1440m dhcp-host=88:53:2E:9B:3E:80,Redtail,192.168.1.5,1440m stop-dns-rebind
The /etc/resolv.conf file is:
search ph.cox.net nameserver 192.168.1.1
And the /tmp/resolv.dnsmasq file is:
nameserver 220.127.116.11 nameserver 18.104.22.168 nameserver 22.214.171.124
Another smaller, but unrelated, issue: On dd-wrt's "basic setup" page in the DHCP config section I have entered the IPs for OpenDNS's servers (as you can see above). I'd prefer to just use these two nameservers, but the nameserver is automatically tacked on as the third nameserver. Is there a way to tell dd-wrt to ignore DNS info that it receives when acquiring a DHCP lease from the modem/ISP?
So… what am I doing wrong? Clearly, dnsmasq is not happy with the host-record entries, but what is the correct option to use? I'm putting this information in this location rather than /etc/hosts since the latter is a generated file and not easily modified via the web interface. Of course, I can easily edit it by connecting via SSH, but my changes won't be persistent.