[Dnsmasq-discuss] Multiple search domains

Simon Kelley simon@thekelleys.org.uk
Sun, 17 Apr 2005 10:27:19 +0100


Ken Restivo wrote:
> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
> 
> I've just switched over to dnsmasq from ISC dhcpd, and I'm quite
> pleased.
> 
> One thing that I really miss from ISC-land, though, is the ability to
> specify more than one search domain.
> 
> i.e. I used to put "home.restivo.org restivo.org" into domain_name in
> dhcpd.conf, and sure enough it would serve up two search domains. My
> client resolv.conf's would read "search home.restivo.org restivo.org"
> and everything worked fabulously.
> 
> Alas, I haven't figured out how to get dnsmasq to accept more than
> one domain with separating whitespace for the "domain" option.
> 
> Is there some trick I'm missing? I had a look at the options-parsing
> code in dnsmasq and it looked like stuff I shouldn't mess with ;-).

Let's just say that the options code has expanded well beyond its 
original design :-)

The answer to your domain question is more complicated than it should 
be. The correct way to do it is to use DHCP option 119, as specified in 
RFC 3397. Dnsmasq supports that: the names should be comma-separated.

dhcp-option=119,home.restivo.org,restivo.org

Sadly, most DHCP clients don't support option 119, (The only one I know 
of which is does is Debian's dhcpcd), hence people use spaces in the 
domain name option. When the domain name string gets inserted into 
/etc/resolv.conf it ends up in the correct form for the "search" option. 
Don't expect the same trick to work on Windows or MacOS though.

To pull the trick, you'll need an up-to-date dnsmasq (2.21 or later, I 
think.) which supports quotes in /etc/dnsmasq.conf, then do.

dhcp-option=15,"home.restivo.org restivo.org"


HTH

Simon.