Configure NFS v4 only server in RHEL/Centos 8. Is it possible on RHEL 6 and RHEL 7 ?
Today we will see the steps how to create NFS v4 only server in linux.
We will see how to create NFS server and then how to make it work with only version 4 support, and is not allowed to access from any NFS v2 and v3 clients.
Lets see this step by step.
I. NFS Server Setup
1. Export a filesystem
[root@ngelinux01 saket]# cat /etc/exports /share *(rw,sync,no_root_squash) #Another_example_with_limited_IPs /share 10.207.104.41(rw,sync,no_root_squash) 172.23.90.98(rw,sync,no_root_squash) *(rw,sync,no_root_squash) [root@ngelinux01 saket]#
2. Start NFS service
[root@ngelinux01 saket]# service nfs restart Shutting down NFS daemon: [FAILED] Shutting down NFS mountd: [FAILED] Shutting down NFS quotas: [FAILED] Shutting down NFS services: [ OK ] Shutting down RPC idmapd: [FAILED] Starting NFS services: [ OK ] Starting NFS quotas: [ OK ] Starting NFS mountd: [ OK ] Starting NFS daemon: [ OK ] Starting RPC idmapd: [ OK ] [root@ngelinux01 saket]#
3. Check exportfs to see filesystems exported
[root@ngelinux02 ~]# exportfs /share1 172.23.23.173 /share2 172.23.23.173 /share3
Currently the NFS server supports all NFS v4, v3, and v2 by default in case of RHEL 8 and above.
For RHEL 6, and RHEL 7, they support NFS v4 as client, however do not provide support to create a NFS v4 server.
II. NFS v4 Only Support
Now lets see how to make NFS v4 only server and its some limitations.
1. Update both configuration files like below.
[root@ngelinux02 ~]# cat /etc/nfsmount.conf | grep -v "^#" [ NFSMount_Global_Options ] Defaultvers=4 Nfsvers=4 Defaultproto=tcp Proto=tcp [root@ngelinux02 ~]# cat /etc/nfs.conf | grep -v "^#" vers4=y vers4.0=y vers4.1=y vers4.2=y [root@ngelinux02 ~]#
2. showmount command does not work with NFS v4 server
[root@ngelinux02 ~]# showmount -e clnt_create: RPC: Program not registered [root@ngelinux02 ~]#
Check the exported filesystem using exports command like above.
3. Now restart the NFS server service and changes will start working.
# service nfs restart
Post the service restart the NFS shares can only be accessed from NFS v4 only clients, means it can’t be accessed from RHEL 6, and 7.
And are limited to only NFS v4 clients.