[Dnsmasq-discuss] Next question: domain search lists

Paul Smith psmith at gnu.org
Mon Dec 1 23:53:40 GMT 2008


Thanks for the help so far.  My next challenge is to get my dnsmasq
server to manage DNS domain searches the way I need them to.

I'm resetting /etc/resolv.conf on my dnsmasq server to use "nameserver
127.0.0.1" so I can look up internal hostnames on the server as well.  I
also have set an internal DNS domain, e.g. "mydomain", so I have "search
mydomain" in /etc/resolv.conf.

I run DHCP on the dnsmasq server to get _its_ upstream IP address/DNS
server/etc. information, as well as its domain; I've configured the dhcp
client to update /etc/resolv.conf.upstream and configured dnsmasq to
look at that file as a resolv.conf file.

I've also added "domain=mydomain" to the dnsmasq server config.  This
allows me to do lookups for internal hosts with and without a domain
extension.

I can also do lookups on external hosts as long as I give a
fully-qualified hostname (with a domain on it).

However, any search entries in my /etc/resolv.conf.upstream are ignored,
so if I try to lookup an unqualified upstream hostname I get a failure.

The only thing that seems to fix this is to add the contents of the
search list from /etc/resolv.conf.upstream to the end of
the /etc/resolv.conf search list; something like "search mydomain
gnu.org" or whatever.

Although this works, it's a bit of a pain because that domain is given
to me by my DHCP server and I'd like to avoid hard-coding it.  I could
further tweak the DHCP client config to also update the /etc/resolv.conf
search list when it gets a new lease but ... ouch.


Is there any better way?  There are a number of options in the dnsmasq
config that seem to deal with DNS domains, most of which I don't
understand their purpose very clearly, but I've tried all sorts of
combinations with no joy.

I recognize that the name resolver library will read /etc/resolv.conf
directly so dnsmasq doesn't really have a role here, but does the
resolver library make any attempt to look up just the hostname with no
domain extension?  Or...?


thanks!




More information about the Dnsmasq-discuss mailing list