本文共 3160 字,大约阅读时间需要 10 分钟。
nfs 服务器和客户端区别
NFS is widely deployed and used even after more than twenty year. NFS is easy to set up and easy to use. This introduces how to set up the NFS server and clients. We use the Fedora system as the example. The here is for RHEL/CentOS/Fedora and derived OSes.
NFS甚至在二十多年后仍得到广泛部署和使用。 NFS易于设置且易于使用。 这介绍了如何设置NFS服务器和客户端。 我们以Fedora系统为例。 本适用于RHEL / CentOS / Fedora和派生的操作系统。
The needed packages are nfs
and rpcbind
, install them by yum
or dnf
:
所需的软件包是nfs
和rpcbind
,请通过yum
或dnf
安装它们:
# yum install nfs-utils rpcbind
Configure /etc/exports to give clients the permission to use the NFS directories.
配置/ etc / exports以授予客户端使用NFS目录的权限。
For example, to allow the servers inside subnet 10.0.0.1/24 to mount the /home directory with read/write permission. Add this line to /etc/exports:
例如,允许子网10.0.0.1/24内的服务器安装具有读/写权限的/ home目录。 将此行添加到/ etc / exports:
/home 10.0.0.1/24(rw)
For details of the exports functions, please refer to .
有关导出功能的详细信息,请参阅 。
Enable nfs service on the NFS server so that the NFS service daemon automatically starts each time the server starts:
在NFS服务器上启用nfs服务,以使NFS服务守护程序在每次服务器启动时自动启动:
# /sbin/chkconfig rpcbind on# /sbin/chkconfig nfs on
You may also manually it
您也可以手动它
# service rpcbind start # Note: always start/restart rpcbind before nfs# service nfs start
I repeat it again as it is so important: always start/restart rpcbind before nfs.
我再次重复它,因为它是如此重要: 始终在nfs之前启动/重新启动rpcbind 。
If the server is configured with firewall, allow the ports needed by NFS. During tests when you are not sure whether it’s the firewall settings that causes problems, you may try to flush the iptables rules by # iptables -F
and enable it back after you are sure NFS service is working fine and debug the firewall settings.
如果服务器配置有防火墙,请允许NFS所需的端口。 在测试期间,如果不确定是不是引起问题的防火墙设置,可以尝试通过# iptables -F
刷新iptables规则,并在确定NFS服务可以正常工作并调试防火墙设置之后将其重新启用。
Install the nfs-utils package:
安装nfs-utils软件包:
# yum nfs-utils
Start the service needed by NFS:
启动NFS所需的服务:
# service rpcbind restart
You may also set it to start automatically
您也可以将其设置为自动启动
# chkconfig rpcbind on
You can mount the NFS directory to the mount point:
您可以将NFS目录挂载到挂载点:
# mount NFS_SERVER:/home/userdir MOUNT_POINT
where NFS_SERVER is the NFS server’s address, and MOUNT_POINT is the local mount point on the client side for the NFS directory.
其中NFS_SERVER是NFS服务器的地址,而MOUNT_POINT是客户端在NFS目录上的本地安装点。
You may also consider using autofs on top of NFS as described in .
您还可以考虑使用NFS之上的autofs,如 。
When you find problems, these tips may give you some clues on what’s wrong and the results here are useful when you ask some others for help.
当您发现问题时,这些技巧可能会为您提供一些错误提示,当您向其他人寻求帮助时,此处的结果将非常有用。
On the server side
在服务器端
# service nfs status# service rpcbind status# rpcinfo -p localhost# showmount -e localhost# netstat -ptuln# iptables -S
On the client side
在客户端
# showmount -e $SERVER_IP# rpcinfo -p $SERVER_IP# iptables -S
翻译自:
nfs 服务器和客户端区别
转载地址:http://mblwd.baihongyu.com/