[NTLUG:Discuss] Hosts using DHCP

Darin W. Smith darin_ext at darinsmith.net
Wed Feb 26 15:38:53 CST 2003


On 26 Feb 2003 15:14:59 -0600, Jack Snodgrass <jack+ntlug at mylinuxguy.net> 
wrote:

> The /etc/hosts file is one of the things that is used to resolve names to 
> ip addresses. The /etc/hosts file is searched BEFORE doing a dns query.

Not necessarily.  You can specify a search order.  For some resolvers, this 
is done in /etc/resolv.conf, i.e.,
order dns,nis+,nis,hosts

would specify to first try DNS, then try NIS+ and NIS, then finally go to 
hosts.

Some of the more modern distributions configure the order elsewhere, but I 
can't remember where.  I hate it when people (RH mainly) move stuff like 
that out of the "standard" locations.

>
> The /etc/hosts file is ( generally ) local to the server it is on. If you 
> have multiple machines on your network and you have a set of private 
> addresses, you'd have to copy the same /etc/hosts file to each machine on 
> the network. Each time
> you made an update, if you wanted all of the machines to know
> about it, you'd have to copy the updated /etc/hosts file to each machine. 
> The /etc/hosts file isn't meant to be used to resolve a lot of names.
>

This is what NIS (yp) is for, and a whole lot more.  Before LDAP came 
along, NIS was probably the cleanest way to distribute host files, mail 
alias files, cron jobs, etc. around a Unix network (even with differing 
vendors).  I used to use it quite a bit.  Nowadays, if you have the 
patience, you can get LDAP to do some or all of these things.


> If you are running a DHCP server and not running a DNS server, you can 
> put all of your IP Addresses and DHCP names in your /etc/hosts file. 
> You'd have to copy that /etc/hosts file to
> all machines in your network if you want all of the machines
> to be able to resolve the addresses.

And if you ARE running both a DHCP and DNS server, the two need to be 
configured to work together...i.e., the DHCP server must keep the DNS 
server up to date...I prefer to just use dyndns.org.

Now, the original post had to do with Samba.  I am curious, because I've 
done something that keeps my 98 laptop from seeing my desktop.  But my 
desktop can see itself.

The DNS discussion is mainly moot, outside of the inability to ping.  I'm 
sure if you try their IP address you'll be able to ping just fine, and the 
inability to resolve IP hostnames should not affect Samba.  SMB uses WINS 
(a MS kludge that's kinda like DNS, only for Windows workgroups and 
"domains").  But for peer-to-peer, you don't even have to have a WINS 
server.  SMB is a chatty protocol, which announces itself to the network, 
and other machines also ask if somebody is out there.  That's how it builds 
that "Network Neighborhood" in windows.  Note that this can be a real 
bandwidth killer on large networks...

Well, that wasn't much help, I'm sure, but I wanted to clarify a couple of 
things.

-- 
D!
Darin W. Smith
AIM: JediGrover




More information about the Discuss mailing list