Code Monkey home page Code Monkey logo

go-dnsmasq's Introduction

go-dnsmasq

Latest Version Github All Releases Docker Pulls License

go-dnsmasq is a lightweight (1.2 MB) DNS caching server/forwarder with minimal filesystem and runtime overhead.

Application examples:

  • Caching DNS server/forwarder in a local network
  • Container/Host DNS cache
  • DNS proxy providing DNS search capabilities to musl-libc based clients, particularly Alpine Linux

Features

  • Automatically set upstream nameservers and search domains from resolv.conf
  • Insert itself into the host's /etc/resolv.conf on start
  • Serve static A/AAAA records from a hosts file
  • Provide DNS response caching
  • Replicate the search domain treatment not supported by musl-libc based Linux distributions
  • Supports virtually unlimited number of search paths and nameservers (related Kubernetes article)
  • Configure stubzones (different nameserver for specific domains)
  • Round-robin of DNS records
  • Send server metrics to Graphite and StatHat
  • Configuration through both command line flags and environment variables

Resolve logic

DNS queries are resolved in the style of the GNU libc resolver:

  • The first nameserver (as listed in resolv.conf or configured by --nameservers) is always queried first, additional servers are considered fallbacks
  • Multiple search domains are tried in the order they are configured.
  • Single-label queries (e.g.: "redis-service") are always qualified with the search domains
  • Multi-label queries (ndots >= 1) are first tried as absolute names before qualifying them with the search domains

Command-line options / environment variables

Flag Description Default Environment vars
--listen, -l Address to listen on host[:port] 127.0.0.1:53 $DNSMASQ_LISTEN
--default-resolver, -d Update resolv.conf to make go-dnsmasq the host's nameserver False $DNSMASQ_DEFAULT
--nameservers, -n Comma delimited list of nameservers host[:port]. IPv6 literal address must be enclosed in brackets. (supersedes etc/resolv.conf) - $DNSMASQ_SERVERS
--stubzones, -z Use different nameservers for given domains. Can be passed multiple times. domain[,domain]/host[:port][,host[:port]] - $DNSMASQ_STUB
--hostsfile, -f Path to a hosts file (e.g. ‘/etc/hosts‘) - $DNSMASQ_HOSTSFILE
--hostsfile-poll, -p How frequently to poll hosts file for changes (seconds, ‘0‘ to disable) 0 $DNSMASQ_POLL
--search-domains, -s Comma delimited list of search domains domain[,domain] (supersedes /etc/resolv.conf) - $DNSMASQ_SEARCH_DOMAINS
--enable-search, -search Qualify names with search domains to resolve queries False $DNSMASQ_ENABLE_SEARCH
--rcache, -r Capacity of the response cache (‘0‘ disables caching) 0 $DNSMASQ_RCACHE
--rcache-ttl TTL for entries in the response cache 60 $DNSMASQ_RCACHE_TTL
--no-rec Disable forwarding of queries to upstream nameservers False $DNSMASQ_NOREC
--fwd-ndots Number of dots a name must have before the query is forwarded 0 $DNSMASQ_FWD_NDOTS
--ndots Number of dots a name must have before making an initial absolute query (supersedes /etc/resolv.conf) 1 $DNSMASQ_NDOTS
--round-robin Enable round robin of A/AAAA records False $DNSMASQ_RR
--systemd Bind to socket(s) activated by Systemd (ignores --listen) False $DNSMASQ_SYSTEMD
--verbose Enable verbose logging False $DNSMASQ_VERBOSE
--syslog Enable syslog logging False $DNSMASQ_SYSLOG
--multithreading Enable multithreading (experimental) False
--help, -h Show help
--version, -v Print the version

Enable Graphite/StatHat metrics

EnvVar: GRAPHITE_SERVER
Default:
Set to the host:port of the Graphite server

EnvVar: GRAPHITE_PREFIX
Default: go-dnsmasq
Set a custom prefix for Graphite metrics

EnvVar: STATHAT_USER
Default:
Set to your StatHat account email address

Usage

Run from the command line

Download the binary for your OS from the releases page.

go-dnsmasq is available in two versions. The minimal version (go-dnsmasq-min) has a lower memory footprint but doesn't have caching, stats reporting and systemd support.

   sudo ./go-dnsmasq [options]

Run as a Docker container

Docker Hub trusted builds are available.

docker run -d -p 53:53/udp -p 53:53 janeczku/go-dnsmasq:latest

You can pass go-dnsmasq configuration parameters by setting the corresponding environmental variables with Docker's -e flag.

Serving A/AAAA records from a hosts file

The --hostsfile parameter expects a standard plain text hosts file with the only difference being that a wildcard * in the left-most label of hostnames is allowed. Wildcard entries will match any subdomain that is not explicitly defined. For example, given a hosts file with the following content:

192.168.0.1 db1.db.local
192.168.0.2 *.db.local

Queries for db2.db.local would be answered with an A record pointing to 192.168.0.2, while queries for db1.db.local would yield an A record pointing to 192.168.0.1.

go-dnsmasq's People

Contributors

gondor avatar janeczku avatar luzifer avatar titpetric avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go-dnsmasq's Issues

feature request, wildcard host resolution from hostfile

I'd like to request a feature, a bit of an extension of the hosts file. I'd like to add support for a wildcard domain. I would suggest implementing it as:

IP1  *.server.lan server.lan
IP2 mail.server.lan

I would want it to work similar to nginx server_name directive. Meaning:

resolve server.lan to IP1 (exact match, as now)
resolve mail.server.lan to IP2 (exact match, as now)
resolve www.server.lan to IP1 (wildcard match, new)

My main use is running a VM guest locally on the laptop, using it for a DNS to avoid modifying hosts file on the host. Several projects have a catch-all domain entry point, where it wouldn't be feasible for me to create many hosts file entries, and bind* or other dns servers take too much of configuration / maintenance.

If you're willing to accept a pull request from a newbie, I can also work on implementing the above in Go. I guess I could swing it, even if Go is not my default language :)

Best,
Tit

--hostsfile option cannot work?

I start go-dnsmasq like this:

sudo go-dnsmasq -f /etc/banner_add_hosts --verbose

here is my /etc/banner_add_hosts :

192.168.31.106 test.91htw.com

but I can not access test.91htw.com

dig @192.168.31.106 test.91htw.com

Here is the error message:

; <<>> DiG 9.8.3-P1 <<>> @192.168.31.106 test.91htw.com
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached

Add new --resolvfile and --resolvfile-poll options

Thank you for go-dnsmasq I won't be able to run any musl-libc distro without it :-)
I don't run it inside every Alpine container, instead, I run it on the Docker host (mesos node) with the --default-resolver flag.

I wish I could watch a file for nameserver records and update accordingly. Something like this:

--resolvfile /etc/mesos-dns-servers.conf
--resolvfile-poll 60

Where /etc/mesos-dns-servers.conf contains dynamically populated nameserver records.

Thank you again!

Caching not working

Hello,

I'm trying to use your docker for dns caching.
But i cant figure out which settings to do, to get it work.
I tested without any environment variables, and with DNSMASQ_RCACHE.

In both cases a dig gets always forwarded to the nameserver i set for the docker with DNSMASQ_SERVERS
(checked with a tcpdump)

Can you explain the settings to just use caching functionality?

Thx for help.

PS: the setting DNSMASQ_DEFAULT is not usefull for the docker, or it needs to be changed, cause it inserts a nameserver 0.0.0.0 to the resolv.conf of the docker.

/etc/resolv.conf contains go-dnsmasq ip on first line cause long resolve times

Hi, I found strange behaviour of go-dnsmasq. I run it in docker on one of my servers. Assume that this server ip is 192.168.140.25.

When my /etc/resolv.conf (on host, not in docker) contains only :
nameserver 8.8.8.8
nameserver 8.8.4.4
and I start go-dnsmasq and after start I change /etc/resolv.conf to:
nameserver 192.168.140.25
nameserver 8.8.8.8
nameserver 8.8.4.4
everything works as expected. Resolve times(measured by dig) are around 20ms for addresses not listed in hosts file and 0ms for addresses listed in hosts file. Great!!

But when my resolv.conf looks like this
nameserver 192.168.140.25
nameserver 8.8.8.8
nameserver 8.8.4.4
and I start go-dnsmasq in docker dig times rise to 3000ms for domains not listed in hosts file and 0ms for domains listed in hosts file. I can understand this behaviour go-dnsmasq reads /etc/resolv.conf and start to question itself (first line). But I need the first line in resolv.conf to resolve local adresses to 192.168.140.* on this server and couple of others in 192.168.140.* range.

So I found $DNSMASQ_SERVERS enviroment var. I set it to "8.8.8.8, 8.8.4.4" and I thought this way go-dnsmasq won't look in /etc/resolv.conf and use 8.8.8.8, 8.8.4.4 as DNS, but I think it still does look in /etc/resolv.conf because resolve times (measured by dig) are still around 3000ms when my /etc/resolv.conf looks like this (before I start go-dnsmsasq) :
nameserver 192.168.140.25
nameserver 8.8.8.8
nameserver 8.8.4.4

As a workaround I change /etc/resolv.conf(add 192.168.140.25 line) after I run go-dnsmasq, but It's not practical. And when I have docker "restart: always" feature turned on and I restart my server, go-dnsmasq container autostarts and problem comes back, because in moment of start go-dnsmasq /etc/resolv.conf contains line: nameserver 192.168.140.25 at the beggining.

I think when $DNSMASQ_SERVERS env_var is set go-dnsmasq should not look in /etc/resolv.conf and use DNS listed in env variable.

Maybe I should correct something in my setup or it's something related to docker but it drives me nuts ;]

Anyway......great soft. Big thanks.

Question: Can you use go-dnsmasq as a sidecar in a pod in Kubernetes?

I'd like to configure an nginx resolver to point to go-dnsmasq, my nginx config looks like this:

location ~ ^/(.+)$ {
        resolver 127.0.0.1:53;
        set $backend "http://$1:80";
        proxy_pass $backend;
}

and my Kubernetes pod specification looks like this:

spec:
  containers:
    - name: nginx
      image: "nginx:1.10.0"
      ports:
        - containerPort: 8080
          name: "external"
          protocol: "TCP"
    - name: dnsmasq
      image: "janeczku/go-dnsmasq:release-1.0.5"
      args:
        - --listen
        - "0.0.0.0:53"

But I run into this error:

[error] 9#9: *734 myservice could not be resolved (2: Server failure), client: 127.0.0.1, server: nginx-proxy, request: "GET /myservice HTTP/1.1", host: "localhost:8080"
127.0.0.1 - xxx [30/May/2016:10:34:23 +0000] "GET /myservice HTTP/1.1" 502 173 "-" "curl/7.38.0" "-"

But I can see that go-dnsmasq is up and running:

PORT     STATE SERVICE
53/tcp   open  domain
8080/tcp open  http-proxy
53/udp   open  domain

Is this suppose to work or do I have to manually derive an nginx image based on for example alpine-kubernetes? I think "my" approach would be more simple and it would allow me to use the vanilla nginx image. Do you know if this should work or what I could be doing wrong (if you think it's correctly configured then it might be an nginx issue and I'm of course not implying that you should help me out with that)?

I've also posted this question on stackoverflow.

--rcache not available

HI,
I download the version 1.0.7 from release. However --rcache and others cache related options is not available in the command options

How to check if cache is working?

Hi!
I'm trying to verify cache behavior, and I'm having trouble doing so, so any pointer in the right direction is appreciated.

What I've done so far is:

  • run docker container for the alpine build with go-dnsmasq: docker run -it -e DNSMASQ_RCACHE=-1000 -e DNSMASQ_VERBOSE=true -e DNSMASQ_SYSLOG=true -e DNSMASQ_RCACHE_TTL=30 -e DNSMASQ_ENABLE_SEARCH=true -e GRAPHITE_SERVER=10.116.150.246:2003 janeczku/alpine-kubernetes sh
  • execute ping google.com (or similar) in console
  • inspect the results in logs and on graphite

When executing 1st ping, I get:

/ # ping google.com
level=debug msg="Received DNS query for \"google.com.\" from \"127.0.0.1:47087\" with type 1"
level=debug msg="[30035] Doing initial absolute lookup"
level=debug msg="[30035] Querying upstream 192.168.65.1:53 for qname 'google.com.'"
level=debug msg="Received DNS query for \"google.com.\" from \"127.0.0.1:47087\" with type 28"
level=debug msg="[36035] Doing initial absolute lookup"
level=debug msg="[36035] Querying upstream 192.168.65.1:53 for qname 'google.com.'"
level=debug msg="[30035] Response code from upstream: NOERROR"
level=debug msg="[30035] Initial lookup yielded result. Response to client: NOERROR"
level=debug msg="[30035] Response time: 2.5708ms"
level=debug msg="[36035] Response code from upstream: NOERROR"
level=debug msg="[36035] Initial lookup yielded result. Response to client: NOERROR"
level=debug msg="[36035] Response time: 2.1368ms"
PING google.com (212.92.207.170): 56 data bytes
64 bytes from 212.92.207.170: seq=0 ttl=37 time=0.282 ms

The 2nd one gives:

/ # ping google.com
level=debug msg="Received DNS query for \"google.com.\" from \"127.0.0.1:37248\" with type 1"
level=debug msg="[63180] Doing initial absolute lookup"
level=debug msg="[63180] Querying upstream 192.168.65.1:53 for qname 'google.com.'"
level=debug msg="Received DNS query for \"google.com.\" from \"127.0.0.1:37248\" with type 28"
level=debug msg="[3445] Doing initial absolute lookup"
level=debug msg="[3445] Querying upstream 192.168.65.1:53 for qname 'google.com.'"
level=debug msg="[63180] Response code from upstream: NOERROR"
level=debug msg="[63180] Initial lookup yielded result. Response to client: NOERROR"
level=debug msg="[63180] Response time: 2.8202ms"
level=debug msg="[3445] Response code from upstream: NOERROR"
level=debug msg="[3445] Initial lookup yielded result. Response to client: NOERROR"
level=debug msg="[3445] Response time: 2.0628ms"
PING google.com (212.92.207.155): 56 data bytes
64 bytes from 212.92.207.155: seq=0 ttl=37 time=0.390 ms

And in the graphite I get:
screen shot 2016-08-16 at 14 21 41

So, from what I can see, the lookups are always executed and I don't see any info on cache usage.
It's quite possible that I am not configuring something correctly, but I can't figure out what.

That's it, if you need any other detail I can provide, please let me know.
Thank you!

P.S. the --rcache-ttl documentation might benefit from stating it's in seconds. It's visible from code, but it could save some time :)

Dual Dispatching of Lookups

Hi, I'm really strongly considering using this in my cluster but ideally would like it to dispatch out to multiple servers and use the first response for fast resolution.

I don't mind forking this project and adding it if its not in your roadmap.

My question is: where would be the best spot to hook this functionality in?

I'm looking for an alternative to https://github.com/dcos/spartan . Spartan is in Erlang and not easy to install

high response time when using go-dnsmasq

Hi,

I'm using go-dnsmasq as a sidecar for nginx,

when using go-dnsmasq to query a k8s service the response time about 0.5 sec

Server:		localhost
Address:	127.0.0.1#53

Name:	vault.default.svc.cluster.local
Address: 100.68.156.43


real	0m1.010s
user	0m0.004s
sys	0m0.004s

verbose logs

time="2017-12-10T16:30:32Z" level=debug msg="[63317] Doing absolute lookup" 
time="2017-12-10T16:30:32Z" level=debug msg="[63317] Querying upstream 100.64.0.10:53 for qname 'vault.default.svc.cluster.local.'" 
time="2017-12-10T16:30:32Z" level=debug msg="[63317] Response code from upstream: NOERROR" 
time="2017-12-10T16:30:32Z" level=debug msg="[63317] Absolute lookup yielded result. Response to client: NOERROR" 
time="2017-12-10T16:30:32Z" level=debug msg="[63317] Response time: **767.279**µs" 

when querying k8s directly :

root@management-proxy:/# time nslookup vault 100.64.0.10
Server:		100.64.0.10
Address:	100.64.0.10#53

Name:	vault.default.svc.cluster.local
Address: 100.68.156.43


real	0m0.008s
user	0m0.004s
sys	0m0.000s

container configuration:

  - name: dnsmasq
    image: janeczku/go-dnsmasq:release-1.0.7
    args:
      - --listen
      - "127.0.0.1:53"
      - --hostsfile=/etc/hosts
      - --verbose

any suggestion ?

negative caching

hi,

I think this dnsmasq lightweight version is always doing negative-caching for an indefinite time of period, and it should have a flag to disable it.

This is the formal dnsmasq flag for it:

-N, --no-negcache
Disable negative caching. Negative caching allows dnsmasq to remember "no such domain" answers from upstream nameservers and answer identical queries without forwarding them again.

Usage of --stubmasks

I'm starting up go-dnsmasq like this. When it takes the consul-agent branch, I get the correct results from dig @127.0.0.1 -p 8600 but this isn't working without explicitly specifying the Consul DNS server.

Any ideas?

#!/bin/sh

AGENT=`getent hosts consul-agent`
if [ -z "$AGENT" ]; then
        echo "Consul Agent detected. Using Consul DNS..."
        go-dnsmasq --default-resolver \
                   --search-domains service.consul \
                   --append-search-domains \
                   --hostsfile=/etc/hosts \
                   --stubzones service.consul/127.0.0.1:8600 \
                   --nameservers 8.8.8.8,8.8.4.4
else
        echo "No Consul Agent detected!"
        go-dnsmasq --default-resolver \
                   --append-search-domains \
                   --hostsfile=/etc/hosts \
                   --nameservers 8.8.8.8,8.8.4.4

fi;

Strange problem on Docker container restart

I have encountered a strange issue that only occurs on Docker container restart. The following describes the lifecycle of the Docker containers.

  • All containers brought up with docker-compose up -d.
  • DNS queries are resolved successfully through go-dnsmasq.
  • The app container throws an uncaught error and the container quits (programmed to be this way).
  • Due to the restart: always policy for the container, Docker compose brings the container up again.
  • DNS queries will no fail to resolve through go-dnsmasq.

Have you seen/heard/witnessed anything like this before?

Here are the logs for go-dnsmasq the first time around:

time="2016-08-18T01:43:04Z" level=info msg="Starting go-dnsmasq server 1.0.6" 
time="2016-08-18T01:43:04Z" level=info msg="Nameservers: [192.168.194.2:53]" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"5c7ec388c1b7\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x3}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"hq_db_1\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x3}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"5cf97bd512e0\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x9}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"hq_mq_1\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x9}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"hq_mq_1\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x9}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"5cf97bd512e0\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x9}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"d5e9783b412f\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x2}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"hq_cache_1\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x2}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"hq_cache_1\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x2}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"d5e9783b412f\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x2}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"hq_db_1\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x3}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"5c7ec388c1b7\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x3}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=debug msg="Found host:ip pairs in /etc/hosts:" 
time="2016-08-18T01:43:04Z" level=debug msg="efa3615ca448 : 172.17.0.10" 
time="2016-08-18T01:43:04Z" level=debug msg="localhost : 127.0.0.1" 
time="2016-08-18T01:43:04Z" level=debug msg="localhost : ::1" 
time="2016-08-18T01:43:04Z" level=debug msg="ip6-localhost : ::1" 
time="2016-08-18T01:43:04Z" level=debug msg="ip6-loopback : ::1" 
time="2016-08-18T01:43:04Z" level=debug msg="db : 172.17.0.3" 
time="2016-08-18T01:43:04Z" level=debug msg="5c7ec388c1b7 : 172.17.0.3" 
time="2016-08-18T01:43:04Z" level=debug msg="hq_db_1 : 172.17.0.3" 
time="2016-08-18T01:43:04Z" level=debug msg="db_1 : 172.17.0.3" 
time="2016-08-18T01:43:04Z" level=debug msg="mq : 172.17.0.9" 
time="2016-08-18T01:43:04Z" level=debug msg="5cf97bd512e0 : 172.17.0.9" 
time="2016-08-18T01:43:04Z" level=debug msg="hq_mq_1 : 172.17.0.9" 
time="2016-08-18T01:43:04Z" level=debug msg="mq_1 : 172.17.0.9" 
time="2016-08-18T01:43:04Z" level=debug msg="cache : 172.17.0.2" 
time="2016-08-18T01:43:04Z" level=debug msg="d5e9783b412f : 172.17.0.2" 
time="2016-08-18T01:43:04Z" level=debug msg="hq_cache_1 : 172.17.0.2" 
time="2016-08-18T01:43:04Z" level=debug msg="cache_1 : 172.17.0.2" 
time="2016-08-18T01:43:04Z" level=info msg="Setting host nameserver to %s127.0.0.1" 
time="2016-08-18T01:43:04Z" level=info msg="Ready for queries on tcp://127.0.0.1:53" 
time="2016-08-18T01:43:04Z" level=info msg="Ready for queries on udp://127.0.0.1:53" 
time="2016-08-18T01:43:11Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:58449\" with type 1" 
time="2016-08-18T01:43:11Z" level=debug msg="[65258] Doing initial absolute lookup" 
time="2016-08-18T01:43:11Z" level=debug msg="[65258] Querying upstream 192.168.194.2:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:11Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:58449\" with type 28" 
time="2016-08-18T01:43:11Z" level=debug msg="[65473] Doing initial absolute lookup" 
time="2016-08-18T01:43:11Z" level=debug msg="[65473] Querying upstream 192.168.194.2:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:11Z" level=debug msg="[65473] Response code from upstream: NOERROR" 
time="2016-08-18T01:43:11Z" level=debug msg="[65473] Initial lookup yielded result. Response to client: NOERROR" 
time="2016-08-18T01:43:11Z" level=debug msg="[65473] Response time: 89.599617ms" 
time="2016-08-18T01:43:11Z" level=debug msg="[65258] Response code from upstream: NOERROR" 
time="2016-08-18T01:43:11Z" level=debug msg="[65258] Initial lookup yielded result. Response to client: NOERROR" 
time="2016-08-18T01:43:11Z" level=debug msg="[65258] Response time: 90.566553ms" 

Here are the go-dnsmasq logs upon automated restart (note: the first part of the logs are from the first run above but you'll see the line where go-dnsmasq restarts and it all goes bad):

time="2016-08-18T01:43:04Z" level=info msg="Starting go-dnsmasq server 1.0.6" 
time="2016-08-18T01:43:04Z" level=info msg="Nameservers: [192.168.194.2:53]" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"5c7ec388c1b7\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x3}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"hq_db_1\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x3}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"5cf97bd512e0\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x9}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"hq_mq_1\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x9}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"hq_mq_1\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x9}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"5cf97bd512e0\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x9}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"d5e9783b412f\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x2}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"hq_cache_1\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x2}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"hq_cache_1\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x2}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"d5e9783b412f\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x2}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"hq_db_1\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x3}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"5c7ec388c1b7\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x3}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:04Z" level=debug msg="Found host:ip pairs in /etc/hosts:" 
time="2016-08-18T01:43:04Z" level=debug msg="efa3615ca448 : 172.17.0.10" 
time="2016-08-18T01:43:04Z" level=debug msg="localhost : 127.0.0.1" 
time="2016-08-18T01:43:04Z" level=debug msg="localhost : ::1" 
time="2016-08-18T01:43:04Z" level=debug msg="ip6-localhost : ::1" 
time="2016-08-18T01:43:04Z" level=debug msg="ip6-loopback : ::1" 
time="2016-08-18T01:43:04Z" level=debug msg="db : 172.17.0.3" 
time="2016-08-18T01:43:04Z" level=debug msg="5c7ec388c1b7 : 172.17.0.3" 
time="2016-08-18T01:43:04Z" level=debug msg="hq_db_1 : 172.17.0.3" 
time="2016-08-18T01:43:04Z" level=debug msg="db_1 : 172.17.0.3" 
time="2016-08-18T01:43:04Z" level=debug msg="mq : 172.17.0.9" 
time="2016-08-18T01:43:04Z" level=debug msg="5cf97bd512e0 : 172.17.0.9" 
time="2016-08-18T01:43:04Z" level=debug msg="hq_mq_1 : 172.17.0.9" 
time="2016-08-18T01:43:04Z" level=debug msg="mq_1 : 172.17.0.9" 
time="2016-08-18T01:43:04Z" level=debug msg="cache : 172.17.0.2" 
time="2016-08-18T01:43:04Z" level=debug msg="d5e9783b412f : 172.17.0.2" 
time="2016-08-18T01:43:04Z" level=debug msg="hq_cache_1 : 172.17.0.2" 
time="2016-08-18T01:43:04Z" level=debug msg="cache_1 : 172.17.0.2" 
time="2016-08-18T01:43:04Z" level=info msg="Setting host nameserver to %s127.0.0.1" 
time="2016-08-18T01:43:04Z" level=info msg="Ready for queries on tcp://127.0.0.1:53" 
time="2016-08-18T01:43:04Z" level=info msg="Ready for queries on udp://127.0.0.1:53" 
time="2016-08-18T01:43:11Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:58449\" with type 1" 
time="2016-08-18T01:43:11Z" level=debug msg="[65258] Doing initial absolute lookup" 
time="2016-08-18T01:43:11Z" level=debug msg="[65258] Querying upstream 192.168.194.2:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:11Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:58449\" with type 28" 
time="2016-08-18T01:43:11Z" level=debug msg="[65473] Doing initial absolute lookup" 
time="2016-08-18T01:43:11Z" level=debug msg="[65473] Querying upstream 192.168.194.2:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:11Z" level=debug msg="[65473] Response code from upstream: NOERROR" 
time="2016-08-18T01:43:11Z" level=debug msg="[65473] Initial lookup yielded result. Response to client: NOERROR" 
time="2016-08-18T01:43:11Z" level=debug msg="[65473] Response time: 89.599617ms" 
time="2016-08-18T01:43:11Z" level=debug msg="[65258] Response code from upstream: NOERROR" 
time="2016-08-18T01:43:11Z" level=debug msg="[65258] Initial lookup yielded result. Response to client: NOERROR" 
time="2016-08-18T01:43:11Z" level=debug msg="[65258] Response time: 90.566553ms" 
time="2016-08-18T01:43:31Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:35701\" with type 1" 
time="2016-08-18T01:43:31Z" level=debug msg="[22108] Doing initial absolute lookup" 
time="2016-08-18T01:43:31Z" level=debug msg="[22108] Querying upstream 192.168.194.2:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:31Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:35701\" with type 28" 
time="2016-08-18T01:43:31Z" level=debug msg="[22393] Doing initial absolute lookup" 
time="2016-08-18T01:43:31Z" level=debug msg="[22393] Querying upstream 192.168.194.2:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:31Z" level=debug msg="[22108] Response code from upstream: NOERROR" 
time="2016-08-18T01:43:31Z" level=debug msg="[22108] Initial lookup yielded result. Response to client: NOERROR" 
time="2016-08-18T01:43:31Z" level=debug msg="[22108] Response time: 51.940355ms" 
time="2016-08-18T01:43:31Z" level=debug msg="[22393] Response code from upstream: NOERROR" 
time="2016-08-18T01:43:31Z" level=debug msg="[22393] Initial lookup yielded result. Response to client: NOERROR" 
time="2016-08-18T01:43:31Z" level=debug msg="[22393] Response time: 53.886212ms" 
time="2016-08-18T01:43:37Z" level=info msg="Starting go-dnsmasq server 1.0.6" 
time="2016-08-18T01:43:37Z" level=info msg="Nameservers: [127.0.0.1:53]" 
time="2016-08-18T01:43:37Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"5c7ec388c1b7\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x3}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:37Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"hq_db_1\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x3}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:37Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"5cf97bd512e0\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x9}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:37Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"hq_mq_1\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x9}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:37Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"hq_mq_1\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x9}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:37Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"5cf97bd512e0\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x9}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:37Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"d5e9783b412f\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x2}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:37Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"hq_cache_1\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x2}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:37Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"hq_cache_1\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x2}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:37Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"d5e9783b412f\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x2}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:37Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"hq_db_1\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x3}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:37Z" level=warning msg="Bad formatted hostsfile line: Duplicate hostname entry for &hosts.hostname{domain:\"5c7ec388c1b7\", ip:net.IP{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xac, 0x11, 0x0, 0x3}, ipv6:false, wildcard:false}" 
time="2016-08-18T01:43:37Z" level=debug msg="Found host:ip pairs in /etc/hosts:" 
time="2016-08-18T01:43:37Z" level=debug msg="efa3615ca448 : 172.17.0.10" 
time="2016-08-18T01:43:37Z" level=debug msg="localhost : 127.0.0.1" 
time="2016-08-18T01:43:37Z" level=debug msg="localhost : ::1" 
time="2016-08-18T01:43:37Z" level=debug msg="ip6-localhost : ::1" 
time="2016-08-18T01:43:37Z" level=debug msg="ip6-loopback : ::1" 
time="2016-08-18T01:43:37Z" level=debug msg="db : 172.17.0.3" 
time="2016-08-18T01:43:37Z" level=debug msg="5c7ec388c1b7 : 172.17.0.3" 
time="2016-08-18T01:43:37Z" level=debug msg="hq_db_1 : 172.17.0.3" 
time="2016-08-18T01:43:37Z" level=debug msg="db_1 : 172.17.0.3" 
time="2016-08-18T01:43:37Z" level=debug msg="mq : 172.17.0.9" 
time="2016-08-18T01:43:37Z" level=debug msg="5cf97bd512e0 : 172.17.0.9" 
time="2016-08-18T01:43:37Z" level=debug msg="hq_mq_1 : 172.17.0.9" 
time="2016-08-18T01:43:37Z" level=debug msg="mq_1 : 172.17.0.9" 
time="2016-08-18T01:43:37Z" level=debug msg="cache : 172.17.0.2" 
time="2016-08-18T01:43:37Z" level=debug msg="d5e9783b412f : 172.17.0.2" 
time="2016-08-18T01:43:37Z" level=debug msg="hq_cache_1 : 172.17.0.2" 
time="2016-08-18T01:43:37Z" level=debug msg="cache_1 : 172.17.0.2" 
time="2016-08-18T01:43:37Z" level=info msg="Setting host nameserver to %s127.0.0.1" 
time="2016-08-18T01:43:37Z" level=info msg="Ready for queries on tcp://127.0.0.1:53" 
time="2016-08-18T01:43:37Z" level=info msg="Ready for queries on udp://127.0.0.1:53" 
time="2016-08-18T01:43:41Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:47330\" with type 1" 
time="2016-08-18T01:43:41Z" level=debug msg="[60334] Doing initial absolute lookup" 
time="2016-08-18T01:43:41Z" level=debug msg="[60334] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:41Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:47330\" with type 28" 
time="2016-08-18T01:43:41Z" level=debug msg="[60632] Doing initial absolute lookup" 
time="2016-08-18T01:43:41Z" level=debug msg="[60632] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:41Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:43311\" with type 1" 
time="2016-08-18T01:43:41Z" level=debug msg="[60334] Doing initial absolute lookup" 
time="2016-08-18T01:43:41Z" level=debug msg="[60334] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:41Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:37126\" with type 28" 
time="2016-08-18T01:43:41Z" level=debug msg="[60632] Doing initial absolute lookup" 
time="2016-08-18T01:43:41Z" level=debug msg="[60632] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:43Z" level=debug msg="[60334] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:43311->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:43Z" level=debug msg="[60334] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:43Z" level=debug msg="[60334] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:43311->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:43Z" level=debug msg="[60334] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:43Z" level=debug msg="[60632] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:37126->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:43Z" level=debug msg="[60632] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:43Z" level=debug msg="[60632] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:37126->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:43Z" level=debug msg="[60632] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:43Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:37621\" with type 1" 
time="2016-08-18T01:43:43Z" level=debug msg="[60334] Doing initial absolute lookup" 
time="2016-08-18T01:43:43Z" level=debug msg="[60334] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:43Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:55759\" with type 28" 
time="2016-08-18T01:43:43Z" level=debug msg="[60632] Doing initial absolute lookup" 
time="2016-08-18T01:43:43Z" level=debug msg="[60632] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:44Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:47330\" with type 1" 
time="2016-08-18T01:43:44Z" level=debug msg="[60334] Doing initial absolute lookup" 
time="2016-08-18T01:43:44Z" level=debug msg="[60334] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:44Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:47330\" with type 28" 
time="2016-08-18T01:43:44Z" level=debug msg="[60632] Doing initial absolute lookup" 
time="2016-08-18T01:43:44Z" level=debug msg="[60632] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:45Z" level=debug msg="[60632] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:55759->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:45Z" level=error msg="[60632] Error looking up literal qname 'data.logentries.com.' with upstreams: read udp 127.0.0.1:55759->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:45Z" level=debug msg="[60632] Error forwarding query. Returning SRVFAIL." 
time="2016-08-18T01:43:45Z" level=debug msg="[60632] Response time: 4.001624487s" 
time="2016-08-18T01:43:45Z" level=debug msg="[60632] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:55759->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:45Z" level=debug msg="[60632] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:45Z" level=debug msg="[60334] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:37621->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:45Z" level=error msg="[60334] Error looking up literal qname 'data.logentries.com.' with upstreams: read udp 127.0.0.1:37621->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:45Z" level=debug msg="[60334] Error forwarding query. Returning SRVFAIL." 
time="2016-08-18T01:43:45Z" level=debug msg="[60334] Response time: 4.002642232s" 
time="2016-08-18T01:43:45Z" level=debug msg="[60334] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:37621->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:45Z" level=debug msg="[60334] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:45Z" level=debug msg="[60632] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:55759->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:45Z" level=error msg="[60632] Error looking up literal qname 'data.logentries.com.' with upstreams: read udp 127.0.0.1:55759->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:45Z" level=debug msg="[60632] Error forwarding query. Returning SRVFAIL." 
time="2016-08-18T01:43:45Z" level=debug msg="[60632] Response time: 4.0011479s" 
time="2016-08-18T01:43:45Z" level=debug msg="[60632] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:55759->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:45Z" level=debug msg="[60632] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:45Z" level=debug msg="[60334] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:37621->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:45Z" level=error msg="[60334] Error looking up literal qname 'data.logentries.com.' with upstreams: read udp 127.0.0.1:37621->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:45Z" level=debug msg="[60334] Error forwarding query. Returning SRVFAIL." 
time="2016-08-18T01:43:45Z" level=debug msg="[60334] Response time: 4.002063546s" 
time="2016-08-18T01:43:45Z" level=debug msg="[60334] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:37621->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:45Z" level=debug msg="[60334] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:45Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:52180\" with type 28" 
time="2016-08-18T01:43:45Z" level=debug msg="[60632] Doing initial absolute lookup" 
time="2016-08-18T01:43:45Z" level=debug msg="[60632] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:45Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:47330\" with type 28" 
time="2016-08-18T01:43:45Z" level=debug msg="[60632] Doing initial absolute lookup" 
time="2016-08-18T01:43:45Z" level=debug msg="[60632] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:45Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:51291\" with type 1" 
time="2016-08-18T01:43:45Z" level=debug msg="[60334] Doing initial absolute lookup" 
time="2016-08-18T01:43:45Z" level=debug msg="[60334] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:45Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:47330\" with type 1" 
time="2016-08-18T01:43:45Z" level=debug msg="[60334] Doing initial absolute lookup" 
time="2016-08-18T01:43:45Z" level=debug msg="[60334] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:47Z" level=debug msg="[60632] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:52180->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:47Z" level=debug msg="[60632] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:52180->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:47Z" level=error msg="[60632] Error looking up literal qname 'data.logentries.com.' with upstreams: read udp 127.0.0.1:52180->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:47Z" level=error msg="[60632] Error looking up literal qname 'data.logentries.com.' with upstreams: read udp 127.0.0.1:52180->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:47Z" level=debug msg="[60632] Error forwarding query. Returning SRVFAIL." 
time="2016-08-18T01:43:47Z" level=debug msg="[60632] Error forwarding query. Returning SRVFAIL." 
time="2016-08-18T01:43:47Z" level=debug msg="[60334] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:51291->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:47Z" level=error msg="[60334] Error looking up literal qname 'data.logentries.com.' with upstreams: read udp 127.0.0.1:51291->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:47Z" level=debug msg="[60334] Error forwarding query. Returning SRVFAIL." 
time="2016-08-18T01:43:47Z" level=debug msg="[60334] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:51291->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:47Z" level=debug msg="[60334] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:47Z" level=debug msg="[60632] Response time: 3.50003419s" 
time="2016-08-18T01:43:47Z" level=debug msg="[60632] Response time: 4.001336327s" 
time="2016-08-18T01:43:47Z" level=debug msg="[60334] Response time: 4.001803171s" 
time="2016-08-18T01:43:47Z" level=debug msg="[60632] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:52180->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:47Z" level=debug msg="[60632] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:47Z" level=debug msg="[60334] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:51291->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:47Z" level=error msg="[60334] Error looking up literal qname 'data.logentries.com.' with upstreams: read udp 127.0.0.1:51291->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:47Z" level=debug msg="[60334] Error forwarding query. Returning SRVFAIL." 
time="2016-08-18T01:43:47Z" level=debug msg="[60334] Response time: 3.502600516s" 
time="2016-08-18T01:43:47Z" level=debug msg="[60334] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:51291->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:47Z" level=debug msg="[60334] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:47Z" level=debug msg="[60632] Failed to query upstream 127.0.0.1:53 for qname 'data.logentries.com.': read udp 127.0.0.1:52180->127.0.0.1:53: i/o timeout" 
time="2016-08-18T01:43:47Z" level=debug msg="[60632] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:47Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:42752\" with type 1" 
time="2016-08-18T01:43:47Z" level=debug msg="[60334] Doing initial absolute lookup" 
time="2016-08-18T01:43:47Z" level=debug msg="[60334] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:47Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:41319\" with type 28" 
time="2016-08-18T01:43:47Z" level=debug msg="[60632] Doing initial absolute lookup" 
time="2016-08-18T01:43:47Z" level=debug msg="[60632] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:47Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:35235\" with type 1" 
time="2016-08-18T01:43:47Z" level=debug msg="[6242] Doing initial absolute lookup" 
time="2016-08-18T01:43:47Z" level=debug msg="[6242] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'" 
time="2016-08-18T01:43:47Z" level=debug msg="Received DNS query for \"data.logentries.com.\" from \"127.0.0.1:35235\" with type 28" 
time="2016-08-18T01:43:47Z" level=debug msg="[6447] Doing initial absolute lookup" 
time="2016-08-18T01:43:47Z" level=debug msg="[6447] Querying upstream 127.0.0.1:53 for qname 'data.logentries.com.'"

System details below:

  • Alpine Linux v3.4
  • go-dnsmasq v1.0.6
  • Docker v1.9.1, build a34a1d5 (confirmed same issues on Docker v1.10.x and v1.12.x)

Let me now if there is any other information you need.

Runtime error when hostname is one character

If we use a character for hostname then we have a problem.
Please look at the example and error.

$ echo '127.0.0.1 l' > hosts
$ /go-dnsmasq -f hosts -v

and then error is:

panic: runtime error: slice bounds out of range [recovered]
	panic: runtime error: slice bounds out of range

goroutine 1 [running]:
github.com/codegangsta/cli.HandleAction.func1(0xc8200a1780)
	/go/src/github.com/codegangsta/cli/app.go:478 +0x38e
github.com/janeczku/go-dnsmasq/hostsfile.parseLine(0xc820011930, 0xb, 0x0, 0x0, 0x0)
	/go/src/github.com/janeczku/go-dnsmasq/hostsfile/utils.go:174 +0x936
github.com/janeczku/go-dnsmasq/hostsfile.newHostlistString(0xc820011930, 0xc, 0xc)
	/go/src/github.com/janeczku/go-dnsmasq/hostsfile/utils.go:34 +0x173
github.com/janeczku/go-dnsmasq/hostsfile.newHostlist(0xc820074480, 0xc, 0x20c, 0xc)
	/go/src/github.com/janeczku/go-dnsmasq/hostsfile/utils.go:28 +0x58
github.com/janeczku/go-dnsmasq/hostsfile.(*Hostsfile).loadHostEntries(0xc82001a600, 0x0, 0x0)
	/go/src/github.com/janeczku/go-dnsmasq/hostsfile/hostsfile.go:95 +0xd2
github.com/janeczku/go-dnsmasq/hostsfile.NewHostsfile(0xc820011650, 0x5, 0xc820011910, 0x1, 0x0, 0x0)
	/go/src/github.com/janeczku/go-dnsmasq/hostsfile/hostsfile.go:48 +0x142
main.main.func1(0xc820086a00, 0x0, 0x0)
	/go/src/github.com/janeczku/go-dnsmasq/main.go:287 +0x224a
reflect.Value.call(0x669240, 0x7b5418, 0x13, 0x734358, 0x4, 0xc8200a1700, 0x1, 0x1, 0x0, 0x0, ...)
	/usr/local/go/src/reflect/value.go:432 +0x120a
reflect.Value.Call(0x669240, 0x7b5418, 0x13, 0xc8200a1700, 0x1, 0x1, 0x0, 0x0, 0x0)
	/usr/local/go/src/reflect/value.go:300 +0xb1
github.com/codegangsta/cli.HandleAction(0x669240, 0x7b5418, 0xc820086a00, 0x0, 0x0)
	/go/src/github.com/codegangsta/cli/app.go:487 +0x2ee
github.com/codegangsta/cli.(*App).Run(0xc820001380, 0xc82000a640, 0x4, 0x4, 0x0, 0x0)
	/go/src/github.com/codegangsta/cli/app.go:245 +0xb06
main.main()
	/go/src/github.com/janeczku/go-dnsmasq/main.go:323 +0x10df

goroutine 5 [syscall]:
os/signal.loop()
	/usr/local/go/src/os/signal/signal_unix.go:22 +0x18
created by os/signal.init.1
	/usr/local/go/src/os/signal/signal_unix.go:28 +0x37

goroutine 6 [chan send]:
os/signal.enableSignal(0x2)
	/usr/local/go/src/os/signal/signal_unix.go:49 +0x22
os/signal.Notify.func1(0x2)
	/usr/local/go/src/os/signal/signal.go:117 +0xf8
os/signal.Notify(0xc8200b2000, 0xc82003cf70, 0x3, 0x3)
	/usr/local/go/src/os/signal/signal.go:129 +0x2bf
main.main.func1.1(0xc82001a540)
	/go/src/github.com/janeczku/go-dnsmasq/main.go:145 +0x24b
created by main.main.func1
	/go/src/github.com/janeczku/go-dnsmasq/main.go:149 +0x93

goroutine 17 [runnable]:
runtime.ensureSigM.func1()
	/usr/local/go/src/runtime/signal1_unix.go:207
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1721 +0x1

Comments out multiple times in resolv.conf

When using go-dnsmasq --default-resolver --append-search-domains --hostsfile=/etc/hosts -n 127.0.0.1:8600 as a service and restarting it seems to cause additive commenting in /etc/resolv.conf:

# # #nameserver 8.8.8.8
# # # # # # nameserver 8.8.4.4

All I need to do is to restart and # is added. Reason why the lines look different is because I manually modified the file to enable the 1st nameserver.

I recommend adding a check before # is added.

Support multiple nameservers for stubzones

As a user having multiple VPN connections open at once I need to query different nameservers for different domains. All those nameservers are internal nameservers and not available as delegated nameservers from public (root) nameservers. To achieve this through go-dnsmasq I'd need to specify -z parameter multiple times.

Example

VPN1: searchdomain = network1.local, nameserver = 192.168.1.1
VPN2: searchdomain = network2.local, nameserver = 192.168.2.1

Parameters: go-dnsmasq [...] -z network1.local/192.168.1.1 -z network2.local/192.168.2.1 [...]

This overwrites the network1.local configuration while name resolution for network2.local is working.

dig @localhost test.network1.local => NXDOMAIN
dig @localhost test.network2.local => 192.168.2.5

Possible Solutions

  1. Use an argument parser supporting string arrays which is capable of reading multiple -z parameters
  2. Change the parsing format of -z parameter to support a delimiter (for example -z network1.local/192.168.1.1|network2.local/192.168.2.1)

While I prefer solution 1 as it provides the user with the ability to have much cleaner CLI arguments I think solution 2 would be the solution with minimal amount of changes.

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

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.

Support IPv6 nameservers

As a user being in a network running native IPv6 I prefer to use IPv6 nameserver addresses not to use those constructs mapping IPv4 through IPv6.

Observed behaviour

When trying to start go-dnsmasq using go-dnsmasq [...] -n 2001:4860:4860::8888,2001:4860:4860::8844,8.8.8.8,8.8.4.4 [...] I get this error message:

FATA[0000] This nameserver is invalid: too many colons in address 2001:4860:4860::8888

When trying to start go-dnsmasq using go-dnsmasq [...] -n [2001:4860:4860::8888],[2001:4860:4860::8844],8.8.8.8,8.8.4.4 [...] I get this error message:

FATA[0000] This nameserver is invalid: missing port in address [2001:4860:4860::8888]

Expected behaviour

When starting go-dnsmasq using go-dnsmasq [...] -n 2001:4860:4860::8888,2001:4860:4860::8844,8.8.8.8,8.8.4.4 [...] it is not crashing and trying to resolve names using that IPv6 nameserver.

Add support for Docker/Compose --x-networking

With --links being deprecated and the move to using --x-networking the commenting out everything in /etc/resolv.conf means that the inter-container communication bridge is lost.

cache insert null message when can't connect dns server

forwarding.go

if absoluteErr != nil {
log.Errorf("[%d] Error looking up literal qname '%s' with upstreams: %v", req.Id, name, absoluteErr)
return nil
}

if not return nil here, cache will keep null message, and when dns server works dig will get null message from the cache.

no config file?

I have a big list of stubzones. Can there be something similar to dnsmasq.conf?

support for windows?

why not support windows?
I think if go-dnsmasq have a windows release, will help more people.
thanks for your jobs!

Timeouts, possibility to improve

It seems I'm getting a bunch of timeouts of the sort:

level=error msg="Failure forwarding request \"read udp 172.17.0.3:57073->8.8.8.8:53: i/o timeout\""

While I realize that this may not be necessarily the fault of go-dnsmask, I'm wondering if we can somehow improve the resulting behaviour. I'm using it in a VM in hyper-v, on a laptop I'm using for work. I'm resolving some internal projects and letting the rest forward to 8.8.8.8. as seen above. It's quite frequent that some host won't resolve, and usually running ipconfig /flushdns solves the problem on windows side.

I didn't notice any timeout option in the settings, is this something that's set by a DNS rfc? Any suggestions what I can do? Sure I'm realizing my internet is not the greatest, but on the other hand, 100ms ping to anywhere and 50/20mbit line on LTE doesn't seem like the ISDN speeds I was used to in the 90's.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.