NFSv4 Setup on fc6 x64

See also: NisSetup, NFSv4 Guide, Using NFSv4 in /export, Gentoo HOWTO, exportfs with NFSv4

There are a few tricks:

  • NFSv4 exports a pseudo-filesystem so you usually mount server:/. (Mounting server:/foo/bar will usually result in an error even if your exports is exporting that. Be careful.) It will look funny on the client too, but to make it look the way we're used to seeing it would require a worse hack on the server side.
  • On 64-bit systems (nfsv4 server only), you need to set the correct path for libgssapi_krb5.so in /etc/gssapi_mech.conf

Server Configuration (gandalf)

  • Ensure port 2049 is open on the firewall
  • Put SECURE_NFS="no" in /etc/sysconfig/nfs
  • Ensure that /etc/gssapi_mech.conf is correct. For example, on gandalf, the following is required
    /usr/lib64/libgssapi_krb5.so.2          mechglue_internal_krb5_init
    
  • Ensure that /etc/imapd.conf is correct. The default is probably fine.
  • You may want to set the acl option on /home if you're exporting it. (I'm not sure why.) Then remount: mount -v -o remount /home
  • Configure init scripts:
    chkconfig portmap on
    chkconfig rpcidmap on
    chkconfig nfslock on
    chkconfig --level 0123456 nfs off
    chkconfig --level 345 nfs on
    chkconfig rpcgssd off
    chkconfig --level 0123456 rpcsvcgssd off
    
  • To test, you can manually start/stop init scripts
    /etc/init.d/rpcgssd stop
    /etc/init.d/rpcsvcgssd stop
    /etc/init.d/portmap restart
    /etc/init.d/rpcidmapd restart
    /etc/init.d/nfslock restart
    /etc/init.d/nfs restart
    
  • Create the /export and /export/home directories
  • Add a bind mount in /etc/fstab
    /home                   /export/home            none    bind            0 0
    
  • Add the following to /etc/exports
    /export 207.7.131.16/28(rw,fsid=0,insecure,no_subtree_check,sync)
    /export/home 207.7.131.26/28(rw,async,root_squash,nohide,no_subtree_check)
    
  • export it
    exportfs -rv
    

Once client is setup, you can test on the client via:

mount -t nfs4 gandalf:/ /mnt

Client Configuration

  • Setup NIS first: NisSetup
  • Ensure gandalf is in /etc/hosts
  • Add the following to /etc/fstab:
    gandalf:/home           /home                   nfs4    rw,hard,intr    0 0
    
  • Default /etc/idmapd.conf should suffice, but it should be the same as the one on gandalf
  • Configure init scripts:
    chkconfig portmap on
    chkconfig rpcidmapd on
    chkconfig nfslock off
    chkconfig --level 0123456 nfs off
    chkconfig rpcgssd off
    chkconfig --level 0123456 rpcsvcgssd off
    
  • To test, you can manually start/stop init scripts
    /etc/init.d/nfslock stop
    /etc/init.d/nfs stop
    /etc/init.d/rpcgssd stop
    /etc/init.d/rpcsvcgssd stop
    /etc/init.d/portmap restart
    /etc/init.d/rpcidmapd restart
    
  • Mount everything: mount -a

If /home/tools exists with tools in it, it may be important to link the profile scripts...

ln -s /home/tools/tools.* /etc/profile.d