NFS server mount to Ubuntu server

So I'm having some issues getting my Ubuntu 16.04 machine to successfully mount a FreeBSD export. Initially I was getting a protocol error on the Ubuntu machine which lead me to NFS v4 config with FreeBSD. As I understand it, I need to set a directive in the /etc/exports file for this. Here's my exports file:

Code:
root@firethorn:~ # cat /etc/exports
V4: /
#Berkeley - Ubuntu Linux Machine
/storage -maproot=root 192.168.2.53
#Triglav - FreeBSD Machine
/storage -maproot=root 192.168.2.56

Here's my /etc/rc.conf
Code:
root@firethorn:~ # cat /etc/rc.conf
hostname="firethorn"
ifconfig_dc0="inet 192.168.2.55 netmask 255.255.255.0"
defaultrouter="192.168.2.1"
sshd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
nfs_server_enable="YES"
nfsv4_server_enable="YES"
nfsuserd_enable="YES"
rpcbind_enable="YES"
mountd_flags="-r"
mountd_enable="YES"

Now, I can successfully mount the share on the other FreeBSD machine (not surprised there) but I am getting the unhelpful message on my ubuntu machine : mount.nfs: Unknown error 521

Here's the rpc output from the FreeBSD NFS server
Code:
root@firethorn:~ # rpcinfo -p localhost
   program vers proto   port  service
    100000    4   tcp    111  rpcbind
    100000    3   tcp    111  rpcbind
    100000    2   tcp    111  rpcbind
    100000    4   udp    111  rpcbind
    100000    3   udp    111  rpcbind
    100000    2   udp    111  rpcbind
    100000    4 local    111  rpcbind
    100000    3 local    111  rpcbind
    100000    2 local    111  rpcbind
    100005    1   udp    611  mountd
    100005    3   udp    611  mountd
    100005    1   tcp    611  mountd
    100005    3   tcp    611  mountd
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs

Any suggestions are welcome.
 
So I'm having some issues getting my Ubuntu 16.04 machine to successfully mount a FreeBSD export. Initially I was getting a protocol error on the Ubuntu machine which lead me to NFS v4 config with FreeBSD. As I understand it, I need to set a directive in the /etc/exports file for this. Here's my exports file:


root@firethorn:~ # cat /etc/exports
V4: /
#Berkeley - Ubuntu Linux Machine
/storage -maproot=root 192.168.2.53
#Triglav - FreeBSD Machine
/storage -maproot=root 192.168.2.56


Any suggestions are welcome.


Triglav is an interesting name for the machine.

Anyhow without really trying to debug your system you have two fundamental problems. First one is that unlike Linux all BSD (FreeBSD included) default to NFSv3 which is better and the only NFS version on BSDs except on the FreeBSD which also supports version 4. If I recall correctly (I have a bunch of FreeBSD NFSv3 servers and tons of NFS RedHat clients) export file looks completely differently if you want NFSv4 on FreeBSD (please refer to the official documentation). Secondly if you are using ZFS on FreeBSD you don't even need to use export file as there is a way to tune NFS export right out of ZFS knobs (essentially built in NFS). Please refer to Alen and Michael's book on Advanced ZFS to see how it works.
 
Well, I figured out the issue. I wish I could say I stumbled on to some interesting reason why it wasn't working. Honestly, I tried several things with the rc.conf and exports files. I eventually wiped everything clean and started fresh and the following configs finally worked on both FreeBSD clients and Ubuntu clients.

So for my FreeBSD NFS Server here are my working configs:

Here's my /etc/rc.conf
Code:
hostname="firethorn"
ifconfig_dc0="inet 192.168.2.55 netmask 255.255.255.0"
defaultrouter="192.168.2.1"
sshd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
nfs_server_enable="YES"
rpcbind_enable="YES"
mountd_flags="-r"
rpc_lockd_enable="YES"
rpc_statd_enable="YES"

And here's my /etc/exports
Code:
V4: /
#Entire Network
/storage -network 192.168.2 -mask 255.255.255.0
#Berkeley - Ubuntu Linux Machine
/storage -maproot=root 192.168.2.53

Those configs do the trick. I'll likely remove the specific Berkeley entry. The network entry works on my other FreeBSD client. I would say, by the looks of things, the only difference between my now working setup and the previous one was the changes in the rc.conf. Would be interesting to get someone's take on the reason this version works and why the previous didn't.
 
ok - so maybe I spoke too soon. I rebooted ny FreeBSD server and when I tried to mount the export from my Linux bos I got "protocol not supported". I disabled the last five entries in rc.conf, rebooted then ran these commands from the command line:
rpcbind
nfsd -u -t -n 4
mountd -r

and the mount then is able to be made from the Ubuntu machine. I could easily put those in a one line startup script but I'd rather try and figure out what I'm missing in my rc.conf so that it matches up with those 3 commands.
 
Use nfsv4_server_enable if you need NFSv4. You can remove mountd_flags, the "-r" option is default.

If you look through /etc/rc.d/nfsd:
Code:
                if checkyesno nfsv4_server_enable; then
                        sysctl vfs.nfsd.server_max_nfsvers=4 > /dev/null
                else
                        echo 'NFSv4 is disabled'
                        sysctl vfs.nfsd.server_max_nfsvers=3 > /dev/null
                fi
 
This seems to be working fine for me, CentOS clients:

Code:
nfs_server_enable="YES"
nfs_server_flags="-u -t -n 8"
nfsv4_server_enable="YES"
nfsuserd_enable="YES"
nfsuserd_flags="-domain domain.inside"
rpcbind_enable="YES"
mountd_enable="YES"
mountd_flags="-r"

Code:
/storage -alldirs -maproot=root -network 192.168.10.0/24
V4: /
 
Back
Top