How do you get dnsmasq to specify alternate DNS servers?
Solution 1
Answered my own question, thanks to rfc2132
dhcp-option=6,192.168.0.90,192.168.0.98
However, RFC2132 specifies option 5 as a list of name servers and option 6 as a list of domain name servers, and I'm not sure what the difference is. Either way, option 6 put them correctly as
nameserver 192.168.0.90
nameserver 192.168.0.98
in /etc/resolv.conf
Solution 2
Posting as a separate answer rather than a comment on yours because that way I can use links.
Option 5 is for IEN 116 nameservers — a ridiculously obsolete protocol that Jon Postel wanted dead over twenty years ago. Solaris still supports it, but won't in the next version.
Solution 3
Another way is to set your dnsmasq server to be the DNS server for DHCP, and use /etc/resolv.conf
on the dnsmasq server to specify your list of DNS servers. That way you can easily change DNS (and set aliases) without having to wait for DHCP renewal - just either restart or kill -HUP
dnsmasq to reload the config.
Related videos on Youtube
vishnu
I graduated in June 2010 with a Bachelor of Engineering specializing in Computer Engineering from Carleton University in Ottawa, Ontario.
Updated on September 17, 2022Comments
-
vishnu almost 2 years
I'm working on a network with ~10 kubuntu desktops (and numerous servers and IP phones) and am trying to get dnsmasq to specify another dns server as a failover. I tried using
server=192.168.0.90
but that just added the single dhcp/dns server to /etc/resolv.conf on my test machine (dynamic IP and freshly rebooted with no lease).
-
Admin over 10 yearsAndrew, 'kill' command expects process identifier not process name. You should use either kill -HUP
pidof dnsmasq
or killall -HUP dnsmasq . -
Tek about 8 years@FeridMovsumov use
server=8.8.8.8
in /etc/dnsmasq.conf -
ceving almost 8 years@Tek Google needs to know everything?
-
Tek almost 8 years@ceving If not google then your ISP
-
AnthonyK over 4 yearsFor posterity:
dnsmasq --help dhcp
-
Daniel Böhmer almost 4 yearsThis is the respective textual option which I prefer over opaque numbers like
6
:dhcp-option=option:dns-server,...
-
Coroos over 3 yearsDHCP option 5 is for IEN 116 style 'trivial name server daemon' (tnamed), see en.wikipedia.org/wiki/ARPA_Host_Name_Server_Protocol . Wasn't aware of its existance. Thanks for that!