在 Linux 中,可通过 mount
命令或 /etc/fstab
配置文件的 nfsvers
或 vers
参数指定 NFS 协议版本。例如:
mount -t nfs -o nfsvers=3 <server>:/path /mnt
# 或
mount -t nfs -o vers=4.2 <server>:/path /mnt
在 /etc/fstab
中:
<server>:/path /mnt nfs nfsvers=4.1,timeo=30 0 0
注意:不同内核版本支持的协议范围不同(如 NFSv4.2 需内核≥3.10),且需确保服务端已启用对应版本。建议优先使用 vers
参数(兼容性更好),并通过 rpcinfo -p <server>
验证服务端支持的协议。