I have a server/workstation running Devuan with several NFS exports. OpenBSD doesn't support NFS version 4 so I've configured my server to use NFS version 3 exclusively. Since it's firewalled, I've set a specific RPC/mountd port and use TCP only (no UDP).
For reference, on Devuan/Debian this is done as follows in /etc/defaults/nfs-kernel-server
:
RPCMOUNTDOPTS="-p 5000 --manage-gids --no-nfs-version 2 --no-nfs-version 4 --no-udp"
Where "5000" could be any port you wish to use. You'd have to restart nfs-kernel-service
on the server for these changes to take effect. Of course, don't forget to set an appropriate firewall rule on the server, e.g.
ufw allow in from 192.168.0.0/24 to any port 5000
Here is an example export in /etc/exports
:
/srv/nfs/music 192.168.0.0/24(rw,root_squash,sync,no_subtree_check)
Having created a mountpoint on the OpenBSD client for the NFS share with proper permissions (sudo chown $USER:$USER /mountpoint
), I lazily tried to mount the share simply by doing this:
mount -t nfs host:/srv/nfs/music /data/music
Unfortunately, that didn't quite work. Each time it would yell RPC : Program not registered
at me no matter what I tried.
At times, a simple restart of the NFS service on the server will solve this. It's also helpful to run rpcinfo
from the client to be sure:
rpcinfo -p host
Where "host" is the IP address or hostname (can be set in /etc/hosts
) of the NFS server.
However, after going through the nfs man
page (see here) I went about it in a different way:
mount_nfs -3 -T host:/srv/nfs/music /data/music
Lo and behold, no moreRPC : Program not registered
errors! The -3
option forces the use of NFS version 3 while -T
makes it use TCP explicitly.
Add something like this to /etc/fstab
and you're all set:
host:/srv/nfs/music /data/music nfs -3,-T,rw,nodev,nosuid,soft,intr 0 0
After a mount -a
everything worked as expected.
Read the man pages. Lesson learned.
Cheers!
EDIT : rewrote and added a few things for clarity's sake