localhost or LAN addresses in /etc/hosts

Derek Broughton news at pointerstop.ca
Fri Dec 12 21:22:34 UTC 2008

Chris G wrote:

> On Fri, Dec 12, 2008 at 02:51:26PM -0400, Derek Broughton wrote:

>> I'd say you're just thoroughly misconfigured.  You _can't_ have isbd
>> be
>> all three addresses.  Personally, I don't think if you're running
>> dnsmasq, isbd should be in there at all - _that's_ why you're running
>> your own DNS.
> dnsmasq uses the entries in /etc/hosts to provide information to other
> machines on the LAN.  Thus it *needs* an entry for isbd somewhere to
> tell other machines what isbd's address is.

"somewhere".  It's a long time since I had a configuration using dnsmasq, 
but I thought it would use  the upstream dns, so if your router is already 
doing it, it could get it from there.
> Without dnsmasq the addresses for isbd are all perfectly valid as far
> as I understand it.

They're "valid" - but you can _still_ only get one result returned, and 
I'm not even sure you can guarantee that it will be any specific value 
from /etc/hosts.  So you do a DNS lookup _from_ your machine and it 
doesn't matter whether your result is or or 
192.168.whatever, because those are all the addresses of interfaces on 
your machine.

> Yes, I realise that, I'm not quite sure why there are two but (without
> dnsmasq) it doesn't actuall matter.

Historical.  All other Debian-based distros, afaik, put your local machine name, along with "localhost", on  Ubuntu, for good and logical reasons, decided to put it on (fairly recently - gutsy, I think).

> No, I have static addresses assigned so it's correct.  Apart from
> anything else how, otherwise, would one access things such as printers
> (my hp7310 for example), they have to be fixed addresses.

No they don't, they just have to not change as long as they're on the 

>> Now, the real question is what do you mean by "asking for the address
>> of
>> isbd"?  isbd is, by definition, your local machine, therefore a DNS
>> lookup should always give you 127.x.x.x.  If you mean that you want
>> the address of the host "isbd" on your local network, then the name
>> is probably something like "isbd.isbd.net"
> I'm talking about finding the address of "isbd" from another machine
> on
> the LAN.  That's what dnsmasq is for, if another machine on the LAN
> asks for the address of "isbd" dnsmasq will tell it "".

Well, no, it shouldn't.  It _should_ specify a domain.

> 127.x.x.x is only the right address for "isbd" when the question is
> asked from "isbd".

Any other client doing a lookup should be taking the name "isbd" and 
appending its "search domain" and finding the address that way.  If, from 
your example the search domain is "isbd.net" then dnsmasq should be 
returning the correct values for  "chris" and "home".

More information about the ubuntu-users mailing list