码迷,mamicode.com
首页 > 其他好文 > 详细

NFS共享实验

时间:2014-08-05 22:56:00      阅读:277      评论:0      收藏:0      [点我收藏+]

标签:nfs配置

实验要求:

                                  将/root共享给192.168.10.0/24网段的所有用户读写访问

                                  将/usr/src/共享给192.168.10.20读写访问,同步

                                  192.168.10.21只读访问,异步,访问权限均降为nfsnobody用户

实验环境:

系统:RHEL6.4

NFS Server:192.168.10.10

Client1: 192.168.10.20

Client2: 192.168.10.21

1.软件包安装

配置YUM库

nfs-utils-........

rpcbind..........                          //RHEL5及以下使用portmap软件包,脚本portmap

                

2.修改配置文件


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


/root 192.168.10.0/24 (rw,sync,no_root_squash)

/usr/src 192.168.10.20(rw,sync) 192.168.10.21(ro,async,all_squash)


[root@localhost ~]# setacl -m u:nfsnobody:rwx /usr/src          //给nfsnobody添加本地文件夹写入权限


3.启动服务

service rpcbind restart

service nfs restart

exportfs -rv                                        //服务已经在运行时,修改配置使用该命令重新发布即可


4.客户端测试


[root@localhost ~]#showmount -e 192.168.10.10


Export list for 192.168.10.10:

/usr/src 192.168.10.21,192.168.10.20

/root    192.168.10.0/24


[root@localhost ~]# mkdir -p /nfs/root

[root@localhost ~]# mkdir -p /nfs/usr/src


通过fstab实现开机自动挂载

[root@localhost ~]#vim /etc/fstab

192.168.10.10:/root /nfs/root    nfs defaults 0  0

[root@localhost ~]#mount -a

[root@localhost ~]#dh -h |grep nfs

192.168.10.10......


通过autofs实现触发挂载


[root@localhost ~]#vim  /etc/auto.master

/nfs /etc/auto.data

[root@localhost ~]#vim /etc/auto.data

src -fstype=nfs,rw 192.168.10.10:/usr/src

[root@localhost ~]#service autofs restart

[root@localhost ~]#cd /data/src


NFS共享实验,布布扣,bubuko.com

NFS共享实验

标签:nfs配置

原文地址:http://jennaking.blog.51cto.com/3004127/1536100

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!