iointerrupt
iointerrupt

Reputation: 11

dnsmasq - forwarding local dns queries

I have two Openwrt APs with dnsmasq on each ap. Lets call them DNS1 (main AP on 192.168.10.1) and DNS2 (dumb AP on 192.168.10.2). DNS1 is also the only DHCP server on my local network. I have stubby running on each instance to resolve external DNS requests on ports 5453. I have a couple of static dhcp hosts on DNS1 which I sync to DNS2 and they resolve fine. My problem is, I cannot get DNS2 to query DNS1 if it cannot resolve a local (lan) query. To clarify further: Since DNS1 is also handles DHCP, a new client (client1) will only get resolved by DNS1. Any client using DNS2 as its dns server/resolver will not be able to resolve client1 or client1.lan. I thought adding a 'server=/lan/192.168.10.1' would do the trick, but no luck. Here is my /etc/config/dhcp and autogenerated DNSMASQ.conf from DNS2:

config dnsmasq
    option leasefile '/tmp/dhcp.leases'
    option localservice '1'
    option quietdhcp '1'
    option cachesize '4096'
    option readethers '1'
    option localise_queries '1'
    option expandhosts '1'
    option noresolv '1'
    option rebind_protection '1'
    option rebind_localhost '1'
    option filterwin2k '1'
    option domain 'lan'
    option domainneeded '1'
    list addnhosts '/adblock/custom'
    list addnhosts '/adblock/dlhosts'
    list addnhosts '/adblock/dlhosts-ipv6'
    option local_ttl '300'
    list server '/lan/192.168.10.1'
    list server '127.0.0.1#5453'
# auto-generated config file from /etc/config/dhcp
conf-file=/etc/dnsmasq.conf
domain-needed
filterwin2k
no-resolv
localise-queries
read-ethers
enable-ubus=dnsmasq
expand-hosts
bind-dynamic
local-service
quiet-dhcp
cache-size=4096
domain=lan
server=/lan/192.168.10.1
server=127.0.0.1#5453
addn-hosts=/tmp/hosts
addn-hosts=/adblock/custom
addn-hosts=/adblock/dlhosts
addn-hosts=/adblock/dlhosts-ipv6
dhcp-leasefile=/tmp/dhcp.leases
local-ttl=300
stop-dns-rebind
rebind-localhost-ok
dhcp-broadcast=tag:needs-broadcast
conf-dir=/tmp/dnsmasq.d
user=dnsmasq
group=dnsmasq
dhcp-ignore-names=tag:dhcp_bogus_hostname
bogus-priv
conf-file=/usr/share/dnsmasq/rfc6761.conf

Upvotes: 1

Views: 3640

Answers (1)

adborden
adborden

Reputation: 71

This is likely dnsmasq's rebind protection kicking in from stop-dns-rebind. Check your logs, if you see lines like this then that is your issue.

dnsmasq[3835]: possible DNS-rebind attack detected: hostname.lan

You want to add rebind-domain-ok=lan to your dnsmasq.conf. Your OpenWRT config should look like this:

config dnsmasq
    list rebind_domain 'lan'

Upvotes: 1

Related Questions