Assumptions
I am assuming that we have two networks linked with a vpn connection (net1: 10.99.0.0/24 and net2: 10.34.132.0/24). Also I am assuming that on net1 is a functional NIS master server.
NIS MASTER: nis1.test.org 10.99.0.10
NIS SERVER: nis2.test.org 10.34.132.195
How to setup a NIS client
If you put a servername in /etc/yp.conf, make sure the server is also in /etc/hosts. Otherwise if your system boots and the network is not yet up or DNS isn't reachable, ypserv cannot resolve the servers in /etc/yp.conf and will hang!
vim /etc/hosts
10.99.0.10 nis1.test.org nis1
Install the netbase, portmap and nis packages
apt-get install nis
Configure NIS servers
vim /etc/yp.conf
domain test-auth server nis1.test.org
Make domain binding persistent
vim /etc/defaultdomain
test-auth
Setup 'running' domain
nisdomainname test-auth
Update local maps search rules
vim /etc/nsswitch.conf
passwd: db files compat nis
group: db files compat nis
shadow: db files compat nis
netgroup: nis
Restart NIS services
/etc/init.d/nis stop
/etc/init.d/nis start
Make the auth process query NIS
vim /etc/passwd
+@gods::0:0:::
+::0:0:::/bin/false
vim /etc/group
+:::
Test NIS client setup
id user
ypwhich
Setup a NIS server slave
vim /etc/default/nis
:%s/NISSERVER=false/NISSERVER=slave
:%s/YPPWDDIR=\/etc/YPPWDDIR=\/etc\/yp
:%s/NISMASTER=/NISMASTER=nis1.test.org
:wq
Restart NIS server
/etc/init.d/nis stop
/etc/init.d/nis start
Links:
http://lyre.mit.edu/~powell/debian-howto/nis.html
http://www.server-world.info/en/note?os=Debian_6.0&p=nis
http://www.linuxhelp.in/2010/05/how-to-install-and-configure-nis-server.html