没有公网IP可以自己创建两个虚拟机测试:
假设CP1 ip:192.168.3.102
假设CP2 ip:192.168.3.0
一、先关闭CP1防火墙吧
systemctl stop firewalld
systemctl disable firewalld
二、CP1 CP2 都执行:
yum -y install nfs*
yum -y install rpcbind*
三、在CP1里面:
创建共享文件夹 share1
vim /etc/exports
添加如下命令(自己记得改IP)
/root/share1 192.168.3.0/255.255.255.0(rw,sync,all_squash)
(修改了此命令记得重新启动一下nfs rpcbind服务,否则不会更新你修改的)
四、在CP2里面:
root目录下创建文件夹 share2
五、CP1 CP2 都执行:
启动nfs