While this approach works for small LANs, it isn't very convenient for
larger LANs with many systems on them. For such configurations, it's
generally much better to store all your IP-to-hostname mapping information
on a single machine, and set up what is called a "DNS server" (domain name
service server) on it. Then, you can configure each machine to contact
this particular machine to receive up-to-the-minute IP to name mappings.
This is done by creating an /etc/resolv.conf file on every machine that
looks something like this:
domain gentoo.org
nameserver 192.168.1.1
nameserver 192.168.1.2
In the above /etc/resolv.conf, I tell the system that any host names
that are not qualified (such as "testbox" as opposed to "testbox.gentoo.org,"
etc.) should be considered to be local hostnames. I also specify
that I have a DNS server running on 192.168.1.1, as well as a backup one
running on 192.168.12. Actually, nearly all network-connected Linux PCs
already have a nameserver specified in their resolv.conf file, even if
they aren't on a LAN. This is because they are configured to use a DNS
server at their Internet Service Provider, in order to map hostnames to IP
addresses (so that users on that system can do things like browse the
Web and head over to well-known sites like ibm.com without having to
refer to them by IP address!).