Linux网络服务之NFS

x33g5p2x  于2021-10-06 转载在 Linux  
字(1.0k)|赞(0)|评价(0)|浏览(444)

一、NFS简介

NFS(Network File System 网络文件服务)

NFS 是一种基于 TCP/IP 传输的网络文件系统协议,最初由 Sun 公司开发。
*
通过使用 NFS 协议,客户机可以像访问本地目录一样访问远程服务器中的共享资源
*
特点:

采用TCP/IP传输网络文件
*
安全性低
*
简单易操作
*
适合局域网环境

二、NFS原理

三 、NFS共享存储服务配置的相关步骤

1.服务器端:

#关闭防火墙
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
​
#安装软件包
[root@localhost ~]# yum install nfs-utils.x86_64 rpcbind -y
​
#新建共享目录
[root@localhost ~]# mkdir /share
​
[root@localhost ~]# cd /share/
​
#修改权限
[root@localhost share]# chmod -R 777 /share/
​
#编辑配置文件
[root@localhost share]# vim /etc/exports
/share *
/share 192.168.91.0/24(rw,sync,no_root_squash)
#共享目录  网段           读写,同步,无root权限
[root@localhost ~]# systemctl start rpcbind 
[root@localhost ~]# systemctl start nfs 
​
#查看详细的nfs信息
[root@localhost share]#exportfs -v
​
#重读配置文件
[root@localhost share]#exportfs -r
​
#查看本机发布的 NFS 共享目录
[root@localhost ~]# showmount -e 
​

2.客户端

#挂载服务器至本地文件夹
[root@localhost ~]# mount 192.168.59.102:/share /mnt
​
#查看是否挂载成功
[root@localhost ~]# df -Th
3.测试
#服务器端在共享文件夹下创建目录
[root@localhost share]# cd /share/
[root@localhost share]# touch 1.txt
​
#在客户端的挂载目录下查看是否成功看到文件
[root@localhost ~]# cd /mnt/
[root@localhost mnt]# ls
1.txt
​

相关文章