[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to store/get hosts names when using dhcp ?



On Thu, Mar 27, 2008 at 11:57:09PM -0400, Jabka Atu wrote:
> I'm upgrading my small home network .
> today i use /etc/hosts on each machine to figure out where each host
> goe's as in :
> 
> 192.168.0.1 whitebox.rent.net whitebox
> 192.168.0.2 bluebox.rent.net bluebox
> 192.168.0.3 blackbox.rent.net blackbox
> 
> since if i do any change in machine ip i will be forced to update all
> files.
> how can i make it _dynamically_ (As in if some computer is connected
> to the network then all other computer know about it .

Install dnsmasq on the box that connects to the internet and leave its
/etc/hosts file as is, or add to it when you add a box.  On the other
boxes, remove the network lines from /etc/hosts so that only the
localhost line remains.  Then, you need each box to treat the main box
as a nameserver.  Unfortunatly, there are several ways to do this in
Debian.  There's the lines in /etc/network/interface that works with the
resolvconf package or you just edit the /etc/resolv.conf file per the
man page.

If you want to assign IPs dyanamically, dnsmasq is also a DHCP server
and can handle that too.

Doug.


Reply to: