localhost or LAN addresses in /etc/hosts

Joep L. Blom jlblom at neuroweave.nl
Sat Dec 13 11:20:40 UTC 2008


Chris G schreef:
> On Sat, Dec 13, 2008 at 07:35:24AM +0100, Nils Kassube wrote:
>> Chris G wrote:
>>> On Fri, Dec 12, 2008 at 10:17:53PM +0100, Nils Kassube wrote:
>>>> Chris G wrote:
>>>>> 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.
>>>> Dnsmasq _can_ use the entries from "/etc/hosts" but it can also use
>>>> entries from a separate file e.g. "/etc/hosts.dnsmasq" (I think
>>>> that's the filename proposed in the config file). I would suggest you
>>>> use "/etc/hosts" only for the localhost entry and
>>>> "/etc/hosts.dnsmasq" for everything else. Then the resolver asks
>>>> dnsmasq for everything except localhost.
>>> Then how does the machine where dnsmasq is running (192.168.1.4) get
>>> local addresses? The other machines on the LAN use 192.168.1.4 for DNS
>>> and that's fine with a file such as /etc/hosts.dnsmasq but 192.168.1.4
>>> can't use 192.168.1.4 as it's DNS can it?
>> Yes it can. Or you can use 127.0.0.1 if you prefer.
>>
> You're right of course, but a little extra configuration of dnsmasq is
> required to tell it where the upstream DNS is as, by default, it uses
> /etc/resolv.conf. 
> 
chrid,
I use dnsmasq on my firewall (LEAF) as DNS- and DHCP-server. Look into 
the file dnsmasq.leases DNSmasq stores the given addresses together with 
the systemname and MAC-addresses of the systems on the network.
With respect to printers, address them by name (if you don't know it you 
can lookup the name in dnsmasq.leases).
In my firewall dnsmasq.leases is stored in /var/lib/misc but it maybe 
well elesewhere opn your system.
Hope this helps,
Joep




More information about the ubuntu-users mailing list