Operating System - HP-UX
1833860 Members
2056 Online
110063 Solutions
New Discussion

/etc/hosts file on NIS slave server does not match that of NIS master server

 
SOLVED
Go to solution
Andrew Kaplan
Super Advisor

/etc/hosts file on NIS slave server does not match that of NIS master server

Hi there --

I have NIS running on two 11.11 v1 systems where one is the Master and the other is the Slave. I noticed that the /etc/hosts files on the slave server does not match that on the Master. I want to synchronize the two, and also have it automated so that whenever a new system is added to the domain, the changes that are made on the master are automatically propogated to the slave. How can I do this?
A Journey In The Quest Of Knowledge
8 REPLIES 8
Steven Schweda
Honored Contributor
Solution

Re: /etc/hosts file on NIS slave server does not match that of NIS master server

To propagate changes in one of the NIS master
data base files to the slaves and clients,
consider "yppush". ("man yppush".) "cron"
can arrange to do this for you periodically,
if you wish.

NIS does not update "etc/hosts" files
anywhere. There exist programs like "rsync"
to do things like that:

http://samba.anu.edu.au/rsync/

Is there some actual problem which you are
trying to solve?

Also, in NIS, "slave" normally means "slave
server", which is different from "client".
Which do you mean? (Not that it affects the
material above significantly, but it might be
interesting later.)
Andrew Kaplan
Super Advisor

Re: /etc/hosts file on NIS slave server does not match that of NIS master server

Where is the map file located? I need it in order to run and subsequently configure for cron the yppush utility.
A Journey In The Quest Of Knowledge
Steven Schweda
Honored Contributor

Re: /etc/hosts file on NIS slave server does not match that of NIS master server

> Where is the map file located?

Which file? The stuff in "/var/yp"
determines everything that happens. The last
time I did this (long ago) it was on Solaris,
and there the "hosts" map was derived from
"/etc/hosts" on the NIS master. From what I
can see on an HP-UX system,
"/usr/sbin/stdhosts" gets dragged into the
picture, and I don't know what-all it does.

You could just add something to "/etc/hosts",
or whatever your guess is, do a "ypmake" and
then "ypcat hosts" to see if the change made
it into the NIS data base.
Peter Nikitka
Honored Contributor

Re: /etc/hosts file on NIS slave server does not match that of NIS master server

Hi,

you should read something about NIS to get an idea, how it works on HP-UX.
A list of maps you get via:
ypwhich -m
The content of one of the host maps:
ypcat hosts.byname

At HP-UX (and most UNIX flavours) the NIS information is kept solely in the maps.
Via an entry in /etc/nsswitch.conf (look there!) it is determined, which kind of name service is used for passwd, hosts, ...

Only some UNIXes like SCO-Unix or ReliantUnix call something like 'map2ascii' to integrate NIS information into the 'normal local' source.

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Rasheed Tamton
Honored Contributor

Re: /etc/hosts file on NIS slave server does not match that of NIS master server

Hi,

ypcat hosts - This will give you a list of all the machines
that are in the host tables of the nis master.

man 1M ypbind
Refer to ypserv(1M) and ypfiles(4) for an overview of Network
Information Service.

- Edit the /etc/hosts file on the NIS Master server
and do a yppush
(makes slave servers update their map versions )

man ypxfr will give you the info relates to the scripts which you can use in cron.
Rasheed Tamton
Honored Contributor

Re: /etc/hosts file on NIS slave server does not match that of NIS master server

Hi,
>- Edit the /etc/hosts file on the NIS Master server
and do a yppush
(makes slave servers update their map versions )
I missed the ypmke which is the command to rebuild the text files to data files (maps).

Here is the correct method:
1. vi /etc/hosts (adds new host)
2. ypmake hosts (rebuilds the hosts map only and automatically pushed it to the slave servers

Reg. your question, please note that whenever you add new systems, you have to do the above steps. Because without using ypmake it will not rebuild the text files to map files. Whenever you use ypmake it will also automatically (it calls the yppush command) push the map files from master server to slave server.

The ypxfr* scripts in /var/yp/ can be placed on cron on the SLAVE server only and it will pull all the updated maps from master to slave. The hourly script ypxfr_1perhour can be run on hourly basis on the cron and it will pull the passwd maps from the master so that it will be synchronized on the slave.
Run ypxfr_2perday daily 2 times (12 hr interval) and ypxfr_1perday will pull and sync the other maps from master to slave.
A. Clay Stephenson
Acclaimed Contributor

Re: /etc/hosts file on NIS slave server does not match that of NIS master server

The whole point about using NIS is that you don't want the hosts file to match everywhere. If NIS worked like that then it would be a pointless exercise. You do want the hosts map to be identical of all server but the underlying source file for the applicable map (/etc/hosts? in this case) should only be maintained on the master server. All the other slave servers and clients should have minial hosts, passwd, group, and services files.
If it ain't broke, I can fix that.
Gary Cantwell
Honored Contributor

Re: /etc/hosts file on NIS slave server does not match that of NIS master server

Hi There,

Please take a moment to assign points to those who have taken the time to assist you. Here's how:

http://forums1.itrc.hp.com/service/forums/helptips.do?#33

Thanks,

Gary