rpcbind使用的默认端口是111

nfs服务的端口是随机分配的默认c5的端口范围在1024以下,c6的端口范围在2000以上

第一步:安装nfs-utils 、rpcbind

[root@nfs log]# yun -y install nfs-utils rpcbind


第二步:检查安装的版本信息

[root@nfs /]# rpm -qa nfs-utils rpcbind

rpcbind-0.2.0-12.el6.i686

nfs-utils-1.2.3-70.el6_8.1.i686


第三步:启动服务

[root@nfs /]# /etc/init.d/rpcbind start

[root@nfs /]# /etc/init.d/nfs start


第四步:检查服务是否开启

[root@nfs /]# ps -ef|egrep "rpc|nfs"

rpc       1251     1  0 08:44 ?        00:00:00 rpcbind

root      1499     2  0 08:44 ?        00:00:00 [rpciod/0]

root      3574     1  0 12:58 ?        00:00:00 rpc.rquotad

root      3578     1  0 12:58 ?        00:00:00 rpc.mountd

root      3584     2  0 12:58 ?        00:00:00 [nfsd4]

root      3585     2  0 12:58 ?        00:00:00 [nfsd4_callbacks]

root      3586     2  0 12:58 ?        00:00:00 [nfsd]

root      3587     2  0 12:58 ?        00:00:00 [nfsd]

root      3588     2  0 12:58 ?        00:00:00 [nfsd]

root      3589     2  0 12:58 ?        00:00:00 [nfsd]

root      3590     2  0 12:58 ?        00:00:00 [nfsd]

root      3591     2  0 12:58 ?        00:00:00 [nfsd]

root      3592     2  0 12:58 ?        00:00:00 [nfsd]

root      3593     2  0 12:58 ?        00:00:00 [nfsd]

root      3618     1  0 12:58 ?        00:00:00 rpc.idmapd

rpcuser   3643     1  0 12:58 ?        00:00:00 rpc.statd

root      3698  1907  0 13:04 pts/0    00:00:00 egrep rpc|nfs

第五步:配置开机启动

[root@nfs /]# chkconfig rpcbind on 

[root@nfs /]# chkconfig nfs on

[root@nfs /]# chkconfig --list|egrep "nfs\b|rpcbind"

nfs             0:off   1:off   2:on    3:on    4:on    5:on    6:off

rpcbind         0:off   1:off   2:on    3:on    4:on    5:on    6:off

第六步:创建挂载目录

[root@nfs /]# mkdir /data -p

[root@nfs /]# chown -R nfsnobody.nfsnobody /data

[root@nfs /]# grep nfsnobody /etc/passwd

第七步:配置nfs服务文件

[root@nfs /]# vim /etc/exports 

/data 192.168.79.0/24(rw,sync)

[root@nfs /]# exportfs -rv(平稳启动)

exporting 192.168.79.0/24:/data

第八步:挂载客服端

[root@nfs /]# showmount -e localhost(测试挂载信息)

Export list for localhost:

/data 192.168.79.0/24

[root@nfs /]# mount -t nfs 192.168.79.131:/data /mnt(挂载到客户端)