centos新版本已经把portmap改成rpcbind了


安装:

需要安装nfs-utils rpcbind


启动systemctl start rpcbind.servicesystemctl start nfs.service
端口/进程netstat -lnt (111端口)ps -ef | grep nfs
rpc检查rpcinfo -p localhost 

    

配置文件

NFS默认配置文件/etc/exports存在,但是空文件,有的需要手动创建文件。

/etc/exports  三种方式

常用格式共享目录客户端IP或网段(参数,参数,...,....)
方式1/share/share10.0.0.1/24(rw,sync) 
方式2/share/share10.0.0.0/24(rw,sync.all_squash,anonuid=2000,anongid=2000)
方式3/share/share10.0.0.0/24(ro) 

备注:

sync 同步写入到内存及硬盘中,影响性能!

方式2是常用的一种方式,适合多人共享,表明所有接入客户都匿名方式.

例如:

[root@localhost ~]# cat > /etc/exports << EOF

> /share/share 172.21.93.0/24(rw,sync)

> EOF

[root@localhost ~]# cat /etc/exports

/share/share 172.21.93.0/24(rw,sync)



Linux客户端篇

查看挂载showmount -e   NFS服务器ip
挂载方式mount -t nfs  NFS服务器IP:/共享目录  /mnt(客户端目录)
查看NFS默认自带参数目录/var/lib/nfs/etab
查看NFS挂载连接用户

 /var/lib/nfs/rmtab

开机自启nfs挂载方式1/etc/rc.local  
开机自启nfs挂载方式2/etc/fstab 一般不放在此,若挂载不成功,引起主机无法开机

卸载umount 本地挂载点

例如:umount /mnt

强制卸载挂载:umount -lf /mnt


Windows客户端篇

wKioL1jUvgOSeIGgAAGhOXY__SI848.jpg

运行----CMD

wKioL1jUvn6hx3_eAACaU5sRMdU484.jpg