Setting up a NIS server

tested on NetBSD 9

draft – HA with slave not tested


On master and slave, backup /var/yp/ before you initialize the NIS service, so you can start from scratch again whenever you want

cd /var/
tar czpf yp.dist.tar.gz yp/

Make sure the master and the slave resolve themselves and each other

vi /etc/hosts

Shared NIS setup (Master AND Slave)

Setup the NIS domain name

domainname DOMAIN.TLD

cd /etc/
echo DOMAIN.TLD > mydomain
ln -s mydomain domainname
ln -s mydomain defaultdomain

Enable the NIS service

vi /etc/rc.conf


#not for the slave?

/etc/rc.d/rpcbind restart
/etc/rc.d/ypserv restart
/etc/rc.d/ypbind restart
/etc/rc.d/yppasswdd restart

Master setup

Initialize the NIS databases

ping -c1 nis2
ypinit -m

        next host: nis
        next host: nis2
        next host: [ENTER]

Note that group users with GID 100 is already there on both, Slackware and NetBSD.

cd /var/yp/
vi Makefile.yp

MINUID?=        1000
MINGID?=        1000


cd /var/yp/
echo nis2 nis2 >> ypservers
    make ypservers

and check

    makedbm -u ypservers

Slave setup

Now initialize the NIS databases differently, by pointing to the master’s short hostname

ping -c1 nis
ypinit -s nis

    next host: nis2
    next host: nis
    next host: [ENTER]

    cd /var/yp/

cd /var/yp/
echo nis2 nis2 >> ypservers
echo nis nis >> ypservers
make ypservers

and check

    makedbm -u ypservers

Client setup

Also configure the master as a client to itself, see nis-client.


Create a user

useradd -m -g users usercheck1
passwd -d files usercheck1
cd /var/yp/

You can also update your Secure Maps NIS password as such

yppasswd usercheck1
#passwd -y
#passwd -d nis

HA acceptance

Now it’s time to validate the Master <-> Slave kind-of-HA.

Disconnect the wire from the Master server and see if the slave SSH service on the NIS user is still responding (of course be careful not to use any diskless system on the slave, or make sure that the diskless nfs server isn’t also the NIS master).



23.6.3. Network Information Service (NIS/YP)

how to set up nfs and nis



うにっくすさんの覚え書き - NetBSD - NIS

NetBSD Wiki/tutorials/ how to set up nfs and nis

Adding a New Slave Server

NIS Troubleshooting on Solaris

3.3. Files managed under NIS

Solaris Naming Services Architecture


Replacing NIS with Kerberos and LDAP HOWTO

Samba + NIS