localhost or LAN addresses in /etc/hosts

Chris G cl at isbd.net
Sat Dec 13 10:38:33 UTC 2008


On Fri, Dec 12, 2008 at 05:22:34PM -0400, Derek Broughton wrote:
> 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.
>  
The whole point is to make things easy to configure, my router
certainly *doesn't* know the names/addresses of machines on my LAN and
I don't really see how it could.  Of course dnsmasq does use the
upstream DNS for addresses it doesn't know but the upstream DNS is
currently my ISP's DNS.  The router has both DHCP and DNS turned off
(you can't switch only one off).


> > 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 127.0.0.1 or 127.0.1.1 or 
> 192.168.whatever, because those are all the addresses of interfaces on 
> your machine.
> 
Yes, which work from the machine itself but only 192.168.1.4 will work
for other machines on the LAN so that's the address I want dnsmasq to use.


> > 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 127.0.0.1.  Ubuntu, for good and logical
reasons, decided to put it on 127.0.1.1 (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 192.168.1.44 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 
> network.
> 
?? So what's the difference?  :-)  ... and, if they did change when,
for example, a printer was turned off and then on again (as it might
when using DHCP) how would the rest of the system know the printer's
IP address?


> >> 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 "192.168.1.4".
> 
> Well, no, it shouldn't.  It _should_ specify a domain.
> 
I'm sure I've read somewhere (can't find it now) that dnsmasq
specifically works for 'simple' names for machines on a LAN with
private addresses. 

> > 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".

That spoils the easy configuration though, I need to go round to every
machine and tell it what its "search domain" is.  The whole (well the
major) reason for using dnsmasq is so that I can do eveything on the
one machine.

-- 
Chris Green




More information about the ubuntu-users mailing list