Linux下实现NFS挂载


1.判断linux是否安装了nfs服务 rpm -qa|grep nfs

2.配置/etc/exports文件。

添加:  /root/script 192.168.1.204(insecure,rw,async,no_root_squash)

3.关闭防火墙:service iptables stop 可能使用的端口号

-A INPUT -m state --state NEW -m tcp -p tcp --dport 111 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 111 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 662 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 662 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 875 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 875 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 892 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 892 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2049 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 2049 -j ACCEPT

4.设置被远程访问文件的读写权限:chmod 755 /root/script

5.启动服务:

service nfs start

 

204客户端

1.创建空文件夹file,用于挂载服务器文件

service rpcbind start

2.使用mount命令挂载文件:

mount 192.168.1.223:/root/script /filePath

 

两个nfs服务不能挂载到同一路径下

 

服务器在关闭nfs之前,应先取消客户端的挂载,否则客户端访问会出现卡死情况:umount /filePath

如果客户端取消挂载失败:fuser -km /filePath 取消连接

然后连接客户端执行命令:umount /filePath

最后关闭服务器nfs服务

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值