Operating System - HP-UX
1754280 Members
3288 Online
108813 Solutions
New Discussion юеВ

Re: /etc/hosts question ..

 
SOLVED
Go to solution
someone_4
Honored Contributor

/etc/hosts question ..

we have several boxes with differnt /etc/hosts files. What is the best way to get all the hosts files to be the same. And any specific details that I need to watch out for.And ways to work around them.

Thanks

Richard
20 REPLIES 20
linuxfan
Honored Contributor
Solution

Re: /etc/hosts question ..

Hi Richard,

Why don't you use NIS, easy to manage, but if that is not an option then hmm..

get all the host files onto one host and lets say you have them at /tmp/host1, /tmp/host2,
where host1 is the host file from host1 and so on.

One way of generating a host file is

cd /tmp
cat host* |grep -v "\#" | sort |uniq > final_hosts_file

This will create a unique sorted list of all the hosts.

-HTH
I am RU
They think they know but don't. At least I know I don't know - Socrates
Andrew_4
Honored Contributor

Re: /etc/hosts question ..

Not sure if you've considered using NIS (Networking Information Service).. but that will allow you to have 'syncronised' /etc/hosts...

For details, see the NIS manual... :

http://www.docs.hp.com/hpux/onlinedocs/B1031-90048/B1031-90048.html

Hope this helps !

Andrew
The Unix Programmer's Manual, 2nd Edition, June, 1972: "The number of Unix installations has grown to 10, with more expected."
linuxfan
Honored Contributor

Re: /etc/hosts question ..

Hi Richard,

If you are only concerned about synchronizing hosts then ofcourse setting up DNS is another option.

-Regards
I am RU
They think they know but don't. At least I know I don't know - Socrates
Sridhar Bhaskarla
Honored Contributor

Re: /etc/hosts question ..

If you are too particular about security at your site, you may think twice to use NIS. NIS+ is tedious to configure but supports encryption. Going for LDAP with ssl encryption is too much to think.

DNS is the best way.

Sri
You may be disappointed if you fail, but you are doomed if you don't try
Thierry Poels_1
Honored Contributor

Re: /etc/hosts question ..

hey,
how about using DNS ??
this results in an extremely small hosts file, and all your IP definitions will be centralized.
regards,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
James R. Ferguson
Acclaimed Contributor

Re: /etc/hosts question ..

Hi Richard:

I'd use DNS. Make sure, however, that each server's hosts file has a 'localhost' (127.0.0.1) entry and its own hostname at a minimum.

...JRF...
melvyn burnard
Honored Contributor

Re: /etc/hosts question ..

If you do not want to use thing slike NIS or DNS, you could look at the rdist facility.
man rdist
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
A. Clay Stephenson
Acclaimed Contributor

Re: /etc/hosts question ..

Hi Richard,

Actually you need to think beyond the hosts files, you have the same problem with the /etc/services file, passwd, group, ... .

It's probably time to bite the bullet and implement BOTH DNS and NIS (or NIS+). It's very nice to be able to change an IP address or a passwd in one place and have the changes propogate thoughout your domain.

My personal preference it to resolve hostnames with DNS and everything else with NIS(+).
If you don't have them already, two of your first O'Reilly Books should be 'DNS and BIND' and 'Managing NFS and NIS'.

Get these systems up and running and life becomes much easier.

Regards, Clay
If it ain't broke, I can fix that.
John Bolene
Honored Contributor

Re: /etc/hosts question ..

DNS is the obvious solution.

Otherwise you can create the master hosts file and rcp it to all machines assuming you can use rcp.
It is always a good day when you are launching rockets! http://tripolioklahoma.org, Mostly Missiles http://mostlymissiles.com