[TriLUG] On resolving local names with dnsmasq
Kevin Hunter
hunteke at earlham.edu
Sat Oct 6 13:07:20 EDT 2012
At 10:18am -0400 Fri, 05 Oct 2012, Brian Henning wrote:
> I tried adding nameserver 127.0.0.1 to the end of /etc/resolv.conf,
> but that made no difference.
>
> Short of editing /etc/hosts (which seems like the wrong approach for
> a host assigned by DHCP), how can I get this to work? I'd like to be
> able to do
>
> $ ssh blueman
>
> and have it work instead of it saying "name or service not known."
I believe Aaron Schrab has correctly identified the issue: move the
127.0.0.1 to the beginning of /etc/resolv.conf.
Aaron Joyner will correct my understanding here (yes, please!), but the
underlying assumption of the resolv.conf file is that each DNS server
listed is equivalent: a query for a hostname should return the same
response from all the IPs. So, if one returns a "host not found", then
the hostname does not exist. The point is that a response was returned.
The multiple servers are for redundancy: if one can't reached at all,
then try the next one. As soon as a response is received either
positive or negative, then the client (your machine) can quit.
This is _not_ the expectation at the DNS server, which exists within a
hierarchy: if it can't resolve the name, it asks the next higher-up DNS
server if it knows the name; and so on, until the root servers.
On your local network then, you want *all* machines to use your dnsmasq
machine, including the dnsmasq machine, which means making sure that the
IP address of the dnsmasq machine is first in their respective
/etc/resolv.conf file. It does not have to be 127.0.0.1 on the dnsmasq
machine, as long as the first IP address does to the dnsmasq machine.
Cheers,
Kevin
More information about the TriLUG
mailing list