home | tech | misc | code | bookmarks (broken) | contact | README


NIS in NetBSD

This document is just a set of observations that the How to set up NFS and NIS, in the NetBSD wiki lacks, but in general, that looks a very good guide.

TODO: push information of this document in the wiki?

Server

Configure domainname in command line (domainname command) or in rc.conf(5):

domainname="renegado"

Also, configure your /etc/hosts correctly.

Execute:

# ypinit -m

It will ask you about the server names. If you configured /etc/hosts correctly, the local machine name will appear there.

Add the following lines to rc.conf:

rpcbind=YES
ypserv=YES
ypbind=YES
yppasswdd=YES

Start them:

# /etc/rc.d/rpcbind start
# /etc/rc.d/ypserv start
# /etc/rc.d/ypbind start
# /etc/rc.d/yppasswdd start

If ypbind hang up (see How to set up NFS and NIS), Ctrl-C to return to the shell.

Make databases:

# cd /var/yp
# make

If it complains about ypbind not working, execute /etc/rc.d/ypbind start (it will probably not hang up at this time) and execute make again. (See reference this message in the NetBSD mailing list archives too.)

Client

On the client side, also set the domainname in rc.conf(5):

domainname="renegado"

Initialize client configuration:

# ypinit -c

It will ask for the NIS server. Add NIS IP address or name (if you have DNS).

Add the following lines to rc.conf:

rpcbind=YES
ypbind=YES

Also, start these services:

/etc/rc.d/rpcbind start
/etc/rc.d/ypbind start

You can now change the nsswitch.conf(5) to configure NIS working correctly:

Replace the lines:

group:      compat
hosts:      files dns
passwd:     compat

for:

group:      nis files
hosts:      files dns nis
passwd:     nis files

Note

Take a look that "nis" goes at the end of the line for the "hosts:" line. This is because I got a problem in Firefox (3.6.3) that, after running a few seconds, it started to find hosts by DNS. Simply putting "nis" at the end, make all work. Strange, but worked!

Troubleshooting

Count not find bsd.subdir.mk

# make
make: "/var/yp/Makefile" line 8: Could not find bsd.subdir.mk
make: Fatal errors encountered -- cannot continue

Solution: You need to install comp.tgz set.

TODO: title here again

# make
make: "/etc/mk.conf" line 494: Malformed conditional (${OPSYS} == "IRIX")
make: "/etc/mk.conf" line 494: Need an operator
make: "/etc/mk.conf" line 506: Malformed conditional (${OPSYS} == "SunOS")
make: "/etc/mk.conf" line 506: Need an operator
make: "/usr/share/mk/bsd.init.mk" line 13: if-less endif
make: "/usr/share/mk/bsd.init.mk" line 13: Need an operator
make: Fatal errors encountered -- cannot continue

Solution: You don't need to cd /var/yp && make on clients.

Can ping external IPs, but the names are not resolved

Did you put the "dns" string in for "hosts:" in nsswitch.conf?

TODO: title here again 2

$ ssh host
...
Failed to add the host to the list of known hosts
(/home/user/.ssh/known_hosts).


Solution: Not clear... but it seems that the host you are trying to
connect from, have the "nis" word in the "passwd:" clause when it is not
necessary. Try to use "passwd: compat" instead of "passwd: nis files".

(In my case, I put "passwd: nis files" in a host that didn't needed that
because user information was yet in the host, because these information
was not migrated yet.)

TODO: title here again 3

# /etc/rc.d/ypbind start
ypbind[298]: direct: sendto: No route to host
ypbind[298]: no contactable servers found in /var/yp/binding/renegado.ypservers

Solution: Not clear about the cause of this error, but I just took out interface logging in pf.conf, and everything turned ok.

I commented this line:

# set loginterface ppp0