[Dnsmasq-discuss] Secondary/tertiary dns servers in dhcp offers?
Fri, 12 Nov 2004 20:50:34 +0000
> I have both dns and dhcp set up. When the dnsmasq returns dhcp offers
> to clients, it is sending itself as the primary dns server, which is
> good. However, it's not sending any secondary or tertiary dns server
> addresses back to the clients for them to use if the primary dns server
> is not available for some reason.
> I would have expected it to send any upstream servers it found
> in /etc/resolv.conf as the secondary and tertiary servers for clients to
> use when the primary is down. I have gone through all the options in
> dnsmasq.conf, read the FAQ, and googled around a bit, but I can't see
> how to do this.
It's possible to do (nearly) this. As you noticed, dnsmasq sends of few
DHCP options by default but if you explicitly specify a value for one of
those options, that will override the default value supplied by dnsmasq.
The option number for DNS servers is 6 (from RFC2132), so adding the
following line to /etc/dnsmasq.conf will send 188.8.131.52 and 184.108.40.206 as DNS
servers _instead_ of the default value.
That's not quite what you want, since you want to use the address of the
machine using dnsmasq as well as the backup servers. To do that, you
need to know that dnsmasq will interpret the special value 0.0.0.0 as
it's own address.
will use dnsmasq as the first nameserver, and the last two as backups.
Getting the backup servers from /etc/resolv.conf directly is not possible.
You should think fairly hard before doing this. Don't forget that the
upstream nameservers will not know about any names which dnsmasq is
getting from /etc/hosts or the DHCP system, so a query for those names
which gets sent direct to an upstream nameserver will fail mysteriously.
Worse, I don't think that the DHCP spec actually specifies that the DNS
servers are in priority order, so you might come across a client which
uses a different order and therefore has problems.