网络文件系统,数据传输基于RPC协议,共享文件。vim
nfs服务不监听端口,借助于rpcbind服务通讯,rpcbind 监听端口111。服务器
服务端nfs注册端口到服务端rpcbind,同步到客户端rpcbind,客户端经过端口与服务端nfs通讯网络
yum -y install nfs-utils rpcbind async
服务端:nfs,rpcbind(监听111端口)ui
vim /etc/exportsspa
增长: /data/tmp 192.168.1.2(rw,sync,all_squash,anonuid=1000,anongid=1000) blog
#前面目录为需共享的目录,IP为客户端IP(亦能够IP段,192.168.1.0/24),rw读写,ro只读,sync同步模式,内存数据实时写入,async非同步模式,no_root_squash客户端挂载共享目录后客户端root用户不受约束,权限最大,root_squash挂载后root用户受约束,变为普通用户,all_squash全部用户变为普通用户,anonuid/anongid定义被限定用户的uid和gid内存
mkdir /data/tmp;chmod 777 /data/tmprpc
systemctl start(enable) rpcbind;systemctl start(enable) nfs同步
客户端:rpcbind
showmount -e 192.168.1.1查看本机是否可使用nfs到1.1的IP去
mount -t nfs 192.168.1.1:/data/tmp /mnt (-t指定挂载类型为nfs,IP为nfs服务器IP,目录为共享的目录,/mnt为本机挂载点)