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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • 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. How to restrict ssh logins by user and client address on CentOS/RHEL
  2. How to generate PGP keys using GPG on Linux
  3. dbus-daemon Command Examples in Linux
  4. module: command not found
  5. cp: command not found
  6. “WARNING: Failed to connect to lvmetad. Falling back to device scanning” – error while running LVM commands
  7. How to prevent non-root user from creating crontab entry
  8. auracle Command Examples
  9. repquota Command Examples in Linux
  10. gnome-calculator Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • raw: command not found
  • raw Command Examples in Linux
  • rankmirrors Command Examples in Linux
  • radeontop: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright