CentOS 6.4系统文件服务之NFS
1.CentOS 6.4系统下查看nfs软件是否安装和启动服务
[root@localhost ~]# rpm -aq |egrep 'nfs|rpcbind'
rpcbind-0.2.0-11.el6.i686
nfs-utils-1.2.3-36.el6.i686
nfs-utils-lib-1.1.5-6.el6.i686
[root@localhost ~]# /etc/init.d/rpcbind restart
Stopping rpcbind: [ OK ]
Starting rpcbind: [ OK ]
[root@localhost ~]# /etc/init.d/nfs restart
Shutting down NFS daemon: [ OK ]
Shutting down NFS mountd: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [ OK ]
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS mountd: [ OK ]
Starting NFS daemon: [ OK ]
[root@localhost ~]#
2.修改配置文件
[root@localhost ~]# vim /etc/exports
/home/nfs 2.2.2.10(ro) --这个IP是能读不能写
/home/nfs *(rw,sync,no_root_squash) --其它IP可以读写
3.关于nfs服务端的端口管理
[root@localhost ~]# vim /etc/sysconfig/nfs
RQUOTAD_PORT=875 --开户以下四行
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
4.开启包过滤
[root@localhost ~]# iptables -I INPUT -p tcp -m multiport --ports 111,875,892,2049,32769 -j ACCEPT
[root@localhost ~]# iptables -I INPUT -p udp -m multiport --ports 111,875,892,2049,32769 -j ACCEPT
[root@localhost ~]#
5.查看服务器共享的文件
[root@localhost ~]# showmount -e
Export list for node1:
/home/nfs (everyone)
[root@localhost ~]#
6.客户端挂载
[root@centos media]# /etc/init.d/rpcbind restart
Stopping rpcbind: [ OK ]
Starting rpcbind: [ OK ]
[root@centos media]# showmount -e 2.2.2.27
Export list for 2.2.2.27:
/home/nfs (everyone)
[root@centos media]# mount -t nfs 2.2.2.27:/home/nfs /media/
[root@centos media]# mkdir 2
[root@centos media]# ll
total 4
drwxr-xr-x 2 root root 4096 Jan 13 10:22 2
[root@centos media]#
相关阅读: