关于freebsd:FreeBSD系统安装NFSNetwork-File-System服务并启用基于-IP-认证的机制

1次阅读

共计 1112 个字符,预计需要花费 3 分钟才能阅读完成。

Network File System (NFS)

网络文件系统:能够把网络上的某个资源做为本地硬盘来应用的一种零碎。

该服务次要依赖于:nfsd、mountd 以及 rpcbind

  • nfsd: 接管 NFS 客户端发动的申请
  • mountd: 解决由 nfsd 接管的请潮州
  • rpcbind: 容许客户端发现以后的 NFS 服务端口

服务端配置

编辑 /etc/rc.conf 并退出以下配置:

rpcbind_enable="YES"
nfs_server_enable="YES"
mountd_flags="-r"
mountd_enable="YES"

接着编辑/etc/exports,配置文件服务内容:

/yzpool/hosts/20pro -maproot=root 192.168.1.20

上述配置实现了: 可将本地 /yzpool/hosts/20pro 映射给 192.168.1.20 客户端。且当 192.168.1.20 客户端中的 root 权限等同于本机的 root 权限。

而后咱们重启一下服务器,以及下面的服务全副失效。

如果编辑过 /etc/exports 文件,则须要执行:/etc/rc.d/mountd reload

客户端配置

客户端操作系统以 debian11 为例,该客户机的 IP 地址为在服务端设置的192.168.1.20

首先咱们装置 nfs 客户端利用:

# sudo apt install nfs-common

而后创立一个挂载点,比方我创立一个位于根门路下的 yz 做为持载点:

# sudo mkdir /yz

最初咱们实现挂载:

# sudo mount -t nfs 192.168.1.2:/yzpool/hosts/20pro /yz

如果咱们心愿在系统启动的时候同步进行挂载,则须要编辑 /etc/fstab 文件来实现。

192.168.1.2:/yzpool/hosts/20pro /yz nfs defaults 0 0

而后重新启动服务器进行测试.

其它

dir client1 (options) [client2(options)...]详解:

  • ro / rw : a) ro: 只读 b) rw: 写入加读取
  • sync / async : a) sync: 服务端应答完上次申请后,才会应答下次申请;b) async: 异应应答。
  • wdelay / no_wdelay a) wdelay 服务器预测是间断申请时,将提早提交上次的写申请(晋升写入效率,数据断电易失落)
  • no_all_squash / all_squash a) no_all_squash: 不扭转客户端的

参考文档

https://vitux.com/debian-nfs-…

https://www.thegeekdiary.com/…

https://docs.freebsd.org/doc/…

正文完
 0