Skip to content

Instantly share code, notes, and snippets.

@DanielRussell
Last active October 4, 2017 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanielRussell/57ea022c95f56255fb7fc336a367b265 to your computer and use it in GitHub Desktop.
Save DanielRussell/57ea022c95f56255fb7fc336a367b265 to your computer and use it in GitHub Desktop.

dnsmasq allows multiple upstreams by adding multiple server= lines to the configuration file

server=10.4.0.64
server=8.8.8.8
server=8.8.4.4

Between v2.68 and v2.69, this behavior changed from preferring the first-defined server, to preferring the last-defined server (e.g. from 10.4.0.64 to 8.8.4.4).

A git bisect points to

$ git bisect good
d68c2ca2b7896d6127f9b32d402f299e0b9cf593 is the first bad commit
commit d68c2ca2b7896d6127f9b32d402f299e0b9cf593
Author: Simon Kelley <simon@thekelleys.org.uk>
Date:   Tue Feb 18 22:30:30 2014 +0000

    Cleanup of server reading code, preparation, for dynamic reading from files.

:040000 040000 4c4039ea470c53903095ee54c3f335947f5cb8a0 b63283cf009498d5a88bdbc429accd178a148257 M	src
# Managed by Chef
no-hosts
strict-order
cache-size=5000
no-resolv
no-poll
bind-interfaces
# TODO: decide later if we want this...
# If you want to disable negative caching, uncomment this.
#no-negcache
# Interfaces
interface=lo0
no-dhcp-interface=lo0
# Nameservers
server=10.4.0.64
server=8.8.8.8
server=8.8.4.4
git checkout v2.68 && make clean all >/dev/null 2>&1 && sudo ./src/dnsmasq -C ./dnsmasq.conf -d -q
HEAD is now at 56ad6c9... Bump debian version.
dnsmasq: started, version 2.68 cachesize 5000
dnsmasq: compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack no-ipset auth
dnsmasq: using nameserver 8.8.4.4#53
dnsmasq: using nameserver 8.8.8.8#53
dnsmasq: using nameserver 10.4.0.64#53
dnsmasq: cleared cache
dnsmasq: query[A] www.ted.com from 127.0.0.1
dnsmasq: forwarded www.ted.com to 10.4.0.64
dnsmasq: reply www.ted.com is 54.85.140.87
dnsmasq: reply www.ted.com is 54.175.59.214
git checkout v2.69 && make clean all >/dev/null 2>&1 && sudo ./src/dnsmasq -C ./dnsmasq.conf -d -q
Previous HEAD position was 56ad6c9... Bump debian version.
HEAD is now at 198d940... Update CHANGELOG/release-notes.
dnsmasq: started, version 2.69 cachesize 5000
dnsmasq: compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack no-ipset auth no-DNSSEC
dnsmasq: using nameserver 8.8.4.4#53
dnsmasq: using nameserver 8.8.8.8#53
dnsmasq: using nameserver 10.4.0.64#53
dnsmasq: cleared cache
dnsmasq: query[A] www.ted.com from 127.0.0.1
dnsmasq: forwarded www.ted.com to 8.8.4.4
dnsmasq: reply www.ted.com is 54.85.140.87
dnsmasq: reply www.ted.com is 54.175.59.214
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment