How to share /etc/hosts

hosts-fileinternal-dnsshare

On my lan, all my etc/hosts are identical, except of course the first lines

 127.0.0.1 localhost.localdomain localhost
 192.168.0.1 thismachine.thisdomain thismachine

Is there a simple way (I'm not speaking about DNS) to share the rest of the file, so adding a machine or changing an IP wouldn't be a big deal?

Thx!

Best Answer

You really would be better off setting up a pair of nameservers if you can. I've never really seen a situation where you couldn't replace a cumbersome hosts file situation with a couple of DNS servers (Really, they are easy to setup and run).

However, to answer your question, you can use something like either puppet or cfengine to keep these in sync.

Another question though... I'm not sure why the first few lines need to change?

127.0.0.1 always points to the local machine and would always be localhost.localdomain localhost

The private IP of the machine will be the same hostname on the machine as it is on every other machine?