[Dnsmasq-discuss] Trailing dots and the way dnsmasq handles hosts

Eric S. Johansson esj@harvee.org
Sat, 09 Apr 2005 07:02:36 -0400


John Drake wrote:
> I have a not so serious question/problem regarding dnsmasq.
> 
> I'm new here so I must say that this dns server is by far the best one
> ever made for local networks. Anyways let me get to the point. I have
> a bunch of hostnames setup in /etc/hosts on my slackware box and
> dnsmasq seems to be relaying that info just fine except for one minor
> thing.
> 
> I can only ping it if I add a trailing . such as "ping maclap." and
> "ping maclap" won't work (this is from client machines). I can run
> "nslookup maclap" and it returns the correct ip. So my question is
> obvious now, is there a way to ping local machines by their hostname
> without the dot? It works with nslookup and dig but not with anything
> else.

if I understand you correctly, you want to be able to just refer to 
hosts by short name (xeno vrs xeno.harvee.org to give a real example) 
without a trailing ".".

I think this is what I did (and I will send you my dnsmasq configuration 
file directly)

bogus-priv
resolv-file=/etc/xen/upstream_dns
addn-hosts=/etc/xen/local-hosts
expand-hosts
domain=harvee.org

I think the essential elements are expand-hosts and domain.  Between 
those two, any incomplete name will be expanded to a fully qualified 
domain name and therefore be resolved.

in local-hosts

192.168.25.11   xeno
192.168.25.99   red-xeno
192.168.25.103  tbtf-xeno
192.168.25.100  harvee-xeno
192.168.25.102  igs-xeno inguide.com. www.inguide.com.

as you can see, I dotted the fully qualified names and left the short 
names un-dotted.  it's been awhile since I have read the documentation 
so I'm not sure if that is necessary.  It may be just left over scar 
tissue from working with bind.

and yes like you, I have found this to be a wonderful name server for 
small networks like mine (six real machines, five virtual)

---eric

-- 
http://www.wired.com/wired/archive/13.03/view.html?pg=5

The result of the duopoly that currently defines "competition" is that
prices and service suck. We're the world's leader in Internet
technology - except that we're not.