【RHCE】NFS 实验

主服务器

下载nfs-utils软件包:

1.如果停⽌该服务,启动并启⽤该服务: systemctl enable - now rpcbind

2.要启动 NFS 服务器,并使其在引导时⾃动启动:systemctl enable - now nfs- server
3.配置防火墙,开启服务:

复制代码
[root@localhost ~]# firewall-cmd --permanent --add-service=nfs
success
[root@localhost ~]# firewall-cmd --permanent --add-service=mo
untd
success
[root@localhost ~]# firewall-cmd --permanent --add-service=rpc-bind
success
[root@localhost ~]# firewll-cmd --reload
[root@localhost ~]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens160
  sources: 
  services: cockpit dhcpv6-client dns http mountd nfs rpc-bind ssh
  ports: 
  protocols: 
  forward: yes
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 
[root@localhost ~]# vim /etc/exports
[root@localhost ~]# cat /etc/exports
/data 192.168.244.137(rw)
[root@localhost ~]# systemctl restart nfs-server
[root@localhost ~]# showmount -e 192.168.244.130
Export list for 192.168.244.130:
[root@localhost ~]# vim /etc/exports
[root@localhost ~]# chmod 777 /data
[root@localhost ~]# systemctl restart nfs-server
[root@localhost ~]# showmount -e 192.168.244.130
Export list for 192.168.244.130:
/data *

从服务器:(访问主服务器的内容并且建立自动挂载)

复制代码
[root@openEuler ~]# showmount -e 192.168.244.130
Export list for 192.168.244.130:
/data *
[root@openEuler ~]# mkdir /nfsclient/client-data/ -p
[root@openEuler ~]# mount 192.168.244.130:/data /nfsclient/client-data/
[root@openEuler ~]# df -h /nfsclient/client-data/
Filesystem             Size  Used Avail Use% Mounted on
192.168.244.130:/data   70G  6.9G   64G  10% /nfsclient/client-data
[root@openEuler ~]# cd /nfsclient/client-data/
[root@openEuler client-data]# ll
total 0
-rw-r--r--. 1 root root 0 Jul 10  2024 testfile
[root@openEuler client-data]# touch caicaikan
[root@openEuler client-data]# ll
total 0
-rw-r--r--. 1 nobody nobody 0 Jul 10  2024 caicaikan
-rw-r--r--. 1 root   root   0 Jul 10  2024 testfile
[root@openEuler client-data]# vim /etc/fstab

#重启
[root@openEuler ~]# df -h /nfsclient/client-data/
Filesystem             Size  Used Avail Use% Mounted on
192.168.244.130:/data   70G  6.9G   64G  10% /nfsclient/client-data
相关推荐
fei_sun37 分钟前
RIB、FIB、MAC 、ARP 表
服务器·网络·macos
凌云若寒41 分钟前
BarTender提示#807错误:无法在拥有其他许可证的Licensing Service上激活节点锁定的 Professional 版许可证 的解决办法
运维·服务器·前端·学习·软件需求
Julien20041 小时前
管理 Ansible 配置文件
linux·运维·服务器·ssh·学习方法
逐米时代1 小时前
远程运维诊断减少到场率
java·服务器·前端
pt10431 小时前
CML网络仿真入门-6(结):Cisco Modeling Labs 示例拓扑
服务器·网络
MicrosoftCloud1 小时前
性能排查 01|free 显示内存用了 90% 就是快满了吗?buff/cache 与 available 一次讲清
linux·运维·内存·free·buff/cache
灯澜忆梦2 小时前
【docker】#1 | Docker 初识
运维·docker·容器
风寄巴山秋2 小时前
OpenBMC:Web 页面功能异常排查
运维·服务器·前端·架构
xiaoye-duck2 小时前
《Linux 网络编程》深入理解 epoll(下):epoll 实战开发与 LT/ET 触发模式深度剖析
linux·网络
小鹿的周先生2 小时前
第18章-MCP
服务器·网络·人工智能