我有两个ubuntu系统
案例1:现在服务器在1上运行,客户端在2上运行。
案例2:现在服务器在2上运行,客户端在1上运行。在本例中,文件系统没有挂载。检查过一切都很好。显示错误消息连接超时。
数独挂载-t nfs -o mountvers=4.0 serverip:/Path /local/mountvers=4.0/point
用mountvers=3也试过
你能帮我解决第二种情况吗?
发布于 2023-02-20 15:04:26
连接超时通常意味着服务器由于防火墙而忽略您的请求,或者只是网络配置不正确。
确保您可以平平客户端和客户端可以平分服务器以验证连接性。如果不能,请首先使用ip -br addr之类的内容确保两个IP地址都有,并查看它们是否位于具有有效IP地址的同一网络上。
使用NFSv4的NFS要求这些服务按照Redhat指定的方式工作(注意,我更喜欢使用Redhat文档,因为它们涵盖了更深入的细节,而且更容易导航,但在两种类型的Linux之间的配置非常相似)。
nfsd
rpc.mountd
rpc.nfsd
rpc.rquotad
rpc.idmapd确保您的/etc/exports是正确的。(本例允许ClientIP将/Path挂载为读/写)
/Path clientIP(rw)运行exportfs以导出nfs共享。如果我们重新启动nfs进程,则不需要这样做,但这将允许您共享和取消共享导出,而无需重新启动nfs服务。
exportfs -a # export all shares配置防火墙(可选,但高度推荐/如果防火墙已经安装)
# On server
firewall-cmd --permanent --add-service nfs
firewall-cmd --reload
systemctl restart nfs-server
# On client, this is required for NFSv4.0 but later versions from NFSv4.1 dont require it. NFSv4.1 and later do the callback on the same connection initiated by the client.
# echo "fs.nfs.nfs_callback_tcpport = <callback-port>" >/etc/sysctl.d/90-nfs-callback-port.conf
# sysctl -p /etc/sysctl.d/90-nfs-callback-port.conf
# firewall-cmd --permanent --add-port=<callback-port>/tcp
# firewall-cmd --reloadufw allow from ClientIP to any port nfs
ufw status使用netstat -tuna在服务器上验证nfs正在运行。
通过执行systemctl restart nfs-server验证nfs的工作,然后使用systemctl status nfs-server检查状态。如果一切正常,那么服务器就会正常工作。
上
运行mount -t nfs -o nfsvers=4.0,port=2049,tcp ServerIP:/Path /local/dir
数字海洋:https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nfs-mount-on-ubuntu-22-04
Linux线索:https://linuxhint.com/install-and-configure-nfs-server-ubuntu-22-04/
https://askubuntu.com/questions/1455791
复制相似问题