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

Re: How to reach a computer by hostname on a LAN?

Sorry if my reply was 'off', I read Chris' email and assumed he was talking about a home LAN, since I get this question so often at work. My advice works for the home setup, Gene's works best if you're at work.


Gene Heskett wrote:
On Tuesday 28 December 2004 01:25, Christopher J. Bottaro wrote:

Simple setup.  I have a router that assigns IP addresses by DHCP.  I
have two linux machines:  compa and compb which get their IP
addresses using DHCP with the router.  From compa, I want to be
able to say "ping compb" instead of having to use ifconfig on compb
to figure out what its IP address is, then ping it (i.e. "ping").

How is this possible?  Manually editing the /etc/hosts file doesn't
work because the IP addresses can change at boot (or whenever DHCP
is used to get a new address).


Turn off the dhcp in the router and use the /etc/hosts file to do the resolving. You can use the same hosts file throughout your local network. I've been doing that here for 6 or 7 years. You'll have to assign the local ip address per machine in the /etc/sysconfig/network-scripts/ifcfg-eth0 scripts also, which will give a fixed address for that machine. To me, dhcp on a small home network, or even on an 80+ machine business internal network is a waste of time and resources. But then thats just my opinion too.

One could even setup a cron job on those machines that have a cron, to grab the master copy of the hosts file and refresh it if the network is being constantly changed. That would take a load off the IT guy, who usually has his own pool of alligators to wrestle.

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