NFSv4 on CentOS 5.3 and Fedora 11
To save the Community the trouble of figuring out how to make this work, here are the steps I used to mount nfsv4 shares on Fedora 11 from a CentOS 5.3 server.
When a line starts with “#” or “as root” that means that you have to execute the command as root.
On the *SERVER* side:
1) as root edit /etc/idmapd.conf:
change Nobody-{User,Group} to nfsnobody
change Domain to <your.fully.qualified.domain.name>
2) create directory with exports
# mkdir /nfs4exports/share
3) as root edit /etc/fstab and add nfs4 exports
/somedirectory/youwanttoshare /nfs4exports/share none bind 0 0
4) activate nfsv4 binds
# mount -a
5) as root edit /etc/exports
Replace 192.168.0.0 below with your IP network.
/nfs4exports 192.168.0.0/255.255.255.0(rw,insecure,no_subtree_check,nohide,fsid=0) /nfs4exports/share 192.168.0.0/255.255.255.0(rw,insecure,no_subtree_check,nohide)
6) reload exported filesystems
# exportfs -rv
7) stop & disable services
# service nfs stop
# service nfslock stop
# service portmap stop
8) disable unnecessary services
# chkconfig –level 345 nfslock off
9) as root edit /etc/sysconfig/nfs
Use the settings below and leave all other settings as they are.
MOUNTD_NFS_V1=”no”
MOUNTD_NFS_V2=”no”
RPCNFSDARGS=”-N 2 -N 3 -U”
10) start required services
# service portmap start
# service rpcidmapd start
# service nfs start
# chkconfig –level 345 portmap on
# chkconfig –level 345 rpcidmapd on
# chkconfig –level 345 nfs on
On the *CLIENT* side (the Fedora 11 box):
1) as root edit /etc/idmapd.conf:
change Nobody-{User,Group} to nfsnobody
change Domain to <your.fully.qualified.domain.name>
2) create share directories
Off course you can choose the location yourself.
# mkdir /mnt/share
3) as root edit /etc/fstab
Replace <host> below with the hostname or IP address of your CentOS box.
<host>:/share /mnt/share nfs4 rsize=8192,wsize=8192,timeo=14,intr,user
4) start required services
# service rpcidmapd start
# chkconfig –level 345 rpcidmapd on
5) mount the bunch
# mount -a
The share will also automatically show up in Nautilus where you can click on it to mount it.
Changelog:
Nov 1, 2009: fixed s/rpcbind/rpcidmapd/ typo in client section based on feedback from Mathiaz and Deadpan110 (thanks!)
hi,
good work !
very usefull!
On the client
“service rpcbind start”
I don’t have any rpcbind. Is it rpcidmapd instead?
On the server why don’t you add
MOUNTD_NFS_V3=”no” ?
Thanks,
Mathiaz
@mathiaz …It seems that after a month, this blog owner has not commented back regarding his useful NFSv4 posting.
I can confirm that ‘rpcidmapd’ is what you will need – it may be a typo as the rest of the post refers correcly.
Also, MOUNTD_NFS_V3=”no” can be used but IMHO, it would be best to leave that because NFSv4 can then still be mounted as NFSv3 in case of any difficulties.
Now I have said that… perhaps fallback to NFSv3 would mean that it would not be wise to remove ‘nfslock’ either.
On a final note for other readers… as this method does not use kerberos with any other types of authentication, you will also need a method to match users and group numbers across the server and clients (as with NFSv3)… for a small network (Like my home network)… I just create our few users on every machine which avoids the use of LDAP/NIS/etc (failing to do this will cause some strange owner and group numbers on the client machines and cause the share to be mainly unusable).
Other than that… I also use this posting as a point of reference – good work!
@mathiaz , @Deadpan110 :
Apologies for not responding sooner and thank you both for your feedback. I will correct the rpcbind typo. Please let me know if there’s anything else I should add or change.
Once again I’m back here for my quick n easy point of reference :)
Just a note about my above mentioned
MOUNTD_NFS_V3="no".I am not exactly sure what that is in the config for as when it is set, the nfs service fails to start even with
RPCNFSDARGS="-N 2 -N 3 -U"set. (I suppose I could Google but figured I would leave a comment here to correct my above answer).