首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在ubuntu18.04上挂载ubuntu22.04的NFS文件系统

无法在ubuntu18.04上挂载ubuntu22.04的NFS文件系统
EN

Ask Ubuntu用户
提问于 2023-02-20 10:09:07
回答 1查看 391关注 0票数 0

我有两个ubuntu系统

  1. PC1运行ubuntu18.04
  2. PC2运行ubuntu22.04

案例1:现在服务器在1上运行,客户端在2上运行。

案例2:现在服务器在2上运行,客户端在1上运行。在本例中,文件系统没有挂载。检查过一切都很好。显示错误消息连接超时。

数独挂载-t nfs -o mountvers=4.0 serverip:/Path /local/mountvers=4.0/point

用mountvers=3也试过

你能帮我解决第二种情况吗?

EN

回答 1

Ask Ubuntu用户

发布于 2023-02-20 15:04:26

连接超时通常意味着服务器由于防火墙而忽略您的请求,或者只是网络配置不正确。

检查连通性

确保您可以平平客户端和客户端可以平分服务器以验证连接性。如果不能,请首先使用ip -br addr之类的内容确保两个IP地址都有,并查看它们是否位于具有有效IP地址的同一网络上。

配置NFSv4

使用NFSv4的NFS要求这些服务按照Redhat指定的方式工作(注意,我更喜欢使用Redhat文档,因为它们涵盖了更深入的细节,而且更容易导航,但在两种类型的Linux之间的配置非常相似)。

代码语言:javascript
复制
nfsd
rpc.mountd
rpc.nfsd
rpc.rquotad
rpc.idmapd

确保出口

确保您的/etc/exports是正确的。(本例允许ClientIP将/Path挂载为读/写)

代码语言:javascript
复制
/Path clientIP(rw)

运行exportfs以导出nfs共享。如果我们重新启动nfs进程,则不需要这样做,但这将允许您共享和取消共享导出,而无需重新启动nfs服务。

代码语言:javascript
复制
exportfs -a # export all shares

配置防火墙(可选,但高度推荐/如果防火墙已经安装)

  • 使用firewalld
代码语言:javascript
复制
# 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 --reload
  • 使用ufw
代码语言:javascript
复制
ufw allow from ClientIP to any port nfs
ufw status

Verification

使用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

Documentation

红帽:https://access.redhat.com/documentation/en-us/red_帽子_企业_linux/9/html/管理_文件_系统/输出-nfs-股份_管理文件系统#doc-包装器

数字海洋: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/

票数 1
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1455791

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档