janeczku/go-dnsmasq

Public nameserver preference over entry in hosts file, hosts file ignored if wildcard query

titpetric opened this issue · 3 comments

Is there perhaps a public dns preference vs. hosts file? I'm having issues with wildcards as dnsmasq takes the response from whatever is provided by -n 8.8.8.8 option... info below.

# autogenerated on Sun Sep  4 17:31:48 CEST 2016
10.1.1.2 *.theme.lan
10.1.1.2 theme.lan

nslookup wildcard:

Server:         10.1.1.2
Address:        10.1.1.2#53

** server can't find whatever.theme.lan: NXDOMAIN

nslookup fqdn:

Server:         10.1.1.2
Address:        10.1.1.2#53

Non-authoritative answer:
Name:   theme.lan
Address: 10.1.1.2

logs:

level=info msg="Starting go-dnsmasq server 1.0.0 ..."
level=debug msg="Found host:ip pairs in /conf/hosts:"
level=debug msg="*.theme.lan : 10.1.1.2"
level=debug msg="theme.lan : 10.1.1.2"
level=info msg="Ready for queries on tcp://0.0.0.0:53 [rcache 0] Nameservers: [8.8.8.8:53 8.8.4.4:53]"
level=info msg="Ready for queries on udp://0.0.0.0:53 [rcache 0] Nameservers: [8.8.8.8:53 8.8.4.4:53]"
level=debug msg="Received DNS query for \"whatever.theme.lan.\" from \"10.1.1.2:42689\" with type 1"
level=debug msg="Querying nameserver 8.8.8.8:53 question whatever.theme.lan."
level=debug msg="Received DNS query for \"theme.lan.\" from \"10.1.1.2:38802\" with type 1"

For some reason the hosts check is skipped completely with wildcards.

Most likely it's a docker issue as :latest points to 1.0.0 (Dockerfile) and there are higher version tags available :(

I can't get it to work with tags like release-1.0.2 or release-1.0.6 for that matter, so it doesn't point to a regression issue. I still haven't had time to properly debug the problem however.

Hi there @titpetric, there was an issue with the Dockerfile not having been updated with the corresponding dnsmasq binary version. 😅 Please re-pull one of latest or release-1.0.6 image and it should magically start to work:

INFO[0000] Starting go-dnsmasq server 1.0.6             
INFO[0000] Nameservers: [8.8.8.8:53 8.8.4.4:53]         
DEBU[0000] Found host:ip pairs in host2:                
DEBU[0000] theme.lan : 10.1.1.2                         
DEBU[0000] theme.lan : 10.1.1.2                         
INFO[0000] Setting host nameserver to %s127.0.0.1       
INFO[0000] Ready for queries on tcp://127.0.0.1:53 [cache: disabled] 
INFO[0000] Ready for queries on udp://127.0.0.1:53 [cache: disabled] 
DEBU[0038] [552] Got query for 'A whatever.theme.lan.' from 127.0.0.1:49387 
DEBU[0038] [552] Found name in hostsfile records        
DEBU[0038] [552] Response time: 304.156µs               
DEBU[0416] [47092] Got query for 'A theme.lan.' from 127.0.0.1:56067 
DEBU[0416] [47092] Found name in hostsfile records      
DEBU[0416] [47092] Response time: 304.43µs              
DEBU[0423] [45430] Got query for 'A whatever.theme.lan.' from 127.0.0.1:65535 
DEBU[0423] [45430] Found name in hostsfile records      
DEBU[0423] [45430] Response time: 277.581µs  

It does! Thank you 👍