• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Configure an NFSv4-only Client using nfsconf in CentOS/RHEL 8

By admin

The nfsconf tool

CentOS/RHEL 8 introduces the nfsconf tool to manage the NFS client and server configuration files under NFSv4 and NFSv3. Configure the nfsconf tool using /etc/nfs.conf (the /etc/sysconfig/nfs file from earlier versions of the operating system is deprecated now). Use the nfsconf tool to get, set, or unset NFS configuration parameters.

The /etc/nfs.conf configuration file is composed of multiple sections starting with a key word in square brackets ([keyword]) with value assignments within the section. For an NFS server, configure the [nfsd] section. A value assignment or key is composed of a name for the value, an equals sign, and a setting for the value, such as vers4.2=y. The lines starting with “#” or “;” are ignored, as are any blank lines.

[user@host ~]$ sudo cat /etc/nfs.conf 
...output omitted... 
[nfsd] 
# debug=0 
# threads=8 
# host= 
# port=0 
# grace-time=90 
# lease-time=90 
# tcp=y 
# vers2=n 
# vers3=y 
# vers4=y 
# vers4.0=y 
# vers4.1=y 
# vers4.2=y 
# rdma=n 
#

By default the [nfsd] section’s key-value pairs are commented out. However, the comments show the default options that will take effect if they are unchanged. This provides you with a good starting point for NFS configuration. Use the nfsconf –set section key value to set a value for the key in the specified section.

[user@host ~]$ sudo nfsconf --set nfsd vers4.2 y

This command updates the /etc/nfs.conf configuration file:

[user@host ~]$ sudo cat /etc/nfs.conf 
...output omitted... 
[nfsd] 
vers4.2 = y 
# debug=0 
# threads=8 
# host= 
# port=0 
# grace-time=90 
# lease-time=90 
# tcp=y 
# vers2=n 
# vers3=y 
# vers4=y
# vers4.0=y 
# vers4.1=y 
# vers4.2=y 
# rdma=n 
#

Use the nfsconf –get section key to retrieve the value for the key in the specified section:

[user@host ~]$ sudo nfsconf --get nfsd vers4.2 
y

Use the nfsconf –unset section key to unset the value for the key in the specified section:

[user@host ~]$ sudo nfsconf --unset nfsd vers4.2

Configure an NFSv4-only Client

You can configure an NFSv4-only client by setting the following values on the /etc/nfs.conf configuration file. Start by disabling UDP and other NFSv2 and NFSv3 related keys:

[user@host ~]$ sudo nfsconf --set nfsd udp n 
[user@host ~]$ sudo nfsconf --set nfsd vers2 n 
[user@host ~]$ sudo nfsconf --set nfsd vers3 n

Enable TCP, and NFSv4, related keys.

[user@host ~]$ sudo nfsconf --set nfsd tcp y 
[user@host ~]$ sudo nfsconf --set nfsd vers4 y 
[user@host ~]$ sudo nfsconf --set nfsd vers4.0 y 
[user@host ~]$ sudo nfsconf --set nfsd vers4.1 y 
[user@host ~]$ sudo nfsconf --set nfsd vers4.2 y

As before, the changes appear in the /etc/nfs.conf configuration file:

[user@host ~]$ cat /etc/nfs.conf 
[nfsd] 
udp = n 
vers2 = n 
vers3 = n 
tcp = y 
vers4 = y 
vers4.0 = y 
vers4.1 = y 
vers4.2 = y

Filed Under: CentOS/RHEL, CentOS/RHEL 8, Linux

Some more articles you might also be interested in …

  1. pvcreate error : Can’t open /dev/sdx exclusively. Mounted filesystem?
  2. Linux OS Service ‘smartd’
  3. CentOS / RHEL : How to find if a network port is open or not?
  4. Where to find ASMLib / oracleasm RPMs for CentOS/RHEL, SUSE, OEL
  5. How to Remove virbr0 and lxcbr0 Interfaces on CentOS/RHEL 6,7
  6. LVM ISCSI Physical Volume Not Available After Server Reboot
  7. How To Auto Mount a FileSystem Using Systemd
  8. Sample /etc/mke2fs.conf file
  9. CentOS / RHEL : How to exclude kernel or other packages from getting updated using YUM Versionlock Plugin
  10. CentOS / RHEL 5 : How to configure Interface bonding (NIC teaming)

You May Also Like

Primary Sidebar

Recent Posts

  • How to Configure Automatic Package Updates on the Server in CentOS/RHEL 8
  • FATAL: Error inserting rds_rdma
  • Failed to start LSB: Bring up/down networking – On restarting network service CentOS/RHEL (DHCP client)
  • How To Add Timestamps To dmesg Kernel Boot Log in CentOS/RHEL
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary