找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 9631|回复: 8

[已解决] OpenWRT CC版本(15.05.01) NFS挂载超时问题

[复制链接]
本帖最后由 mvsqr2 于 2016-4-30 14:14 编辑

设备:MW4530r
固件:OpenWrt Chaos Calmer 15.05.1 r49087

问题现象:mount NFS 不成功,但是可以showmount,防火墙已经开放nfs相关端口
以下先描述客户端错误和现象;再给出服务端(openwrt)的配置和日志;最后部分是我的一些猜测
希望大神能给些建议,谢谢!

客户端:错误和现象
客户端:测试showmount - 成功
  1. root@debian:~# showmount -e 192.168.2.1
  2. Export list for 192.168.2.1:
  3. /tmp/log 192.168.2.0/255.255.255.0
复制代码

客户端:测试mount - TCP和UDP均不成功,错误为Connection timed out (此处确保防火墙已开启了NFS相关端口,NFS相关服务也已经开启)
root@debian:~# mount -t nfs -overs=3 -v 192.168.2.1:/tmp/log nfs/
mount.nfs: timeout set for Sun Apr 24 08:11:27 2016
mount.nfs: trying text-based options 'vers=3,addr=192.168.2.1'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.2.1 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 192.168.2.1 prog 100005 vers 3 prot UDP port 32780
mount.nfs: mount(2): Connection timed out
mount.nfs: Connection timed out


root@debian:~# mount -t nfs -overs=3,tcp -v 192.168.2.1:/tmp/log nfs/
mount.nfs: timeout set for Sun Apr 24 08:45:26 2016
mount.nfs: trying text-based options 'vers=3,tcp,addr=192.168.2.1'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.2.1 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=6
mount.nfs: trying 192.168.2.1 prog 100005 vers 3 prot TCP port 32780
mount.nfs: mount(2): Connection timed out

mount.nfs: trying text-based options 'vers=3,tcp,addr=192.168.2.1'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 192.168.2.1 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=6
mount.nfs: trying 192.168.2.1 prog 100005 vers 3 prot TCP port 32780
mount.nfs: mount(2): Connection timed out

mount.nfs: Connection timed out

客户端:测试rpcinfo - 超时
root@debian:~# rpcinfo -p 192.168.2.1
rpcinfo: can't contact portmapper: RPC: Remote system error - Connection timed out

服务端(OpenWRT):配置与日志
服务端(OpenWRT):配置 - 怀疑RPCD的配置有问题,因为NFS3应该不能用户验证的
  1. # /etc/exports
  2. /tmp/log 192.168.2.0/255.255.255.0(ro,fsid=0,all_squash,insecure,sync,no_subtree_check)

  3. # /etc/config/rpcd
  4. config login
  5.         option username 'root'
  6.         option password '$p$root'
  7.         list read '*'
  8.         list write '*'
复制代码


服务端(OpenWRT):日至 - 验证成功(应该是IP方式)
# logread
Sun Apr 24 08:47:35 2016 daemon.notice rpc.mountd[5170]: authenticated mount request from 192.168.2.3:798 for /tmp/log (/tmp/log)

服务端(OpenWRT):端口监听状态 - 111,2049,32777~32780的TCP和UDP都在监听中
# netstat
root@OpenWrt:~# netstat -lnput
netstat: showing only processes with your user ID
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:2049            0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:8200            0.0.0.0:*               LISTEN      3399/minidlna
tcp        0      0 0.0.0.0:32777           0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:32778           0.0.0.0:*               LISTEN      5172/rpc.statd
tcp        0      0 0.0.0.0:32780           0.0.0.0:*               LISTEN      5170/rpc.mountd
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      5139/portmap
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      3516/uhttpd
tcp        0      0 0.0.0.0:53              0.0.0.0:*               LISTEN      5102/dnsmasq
tcp        0      0 192.168.2.1:22          0.0.0.0:*               LISTEN      2897/dropbear
tcp        0      0 :::80                   :::*                    LISTEN      3516/uhttpd
tcp        0      0 :::53                   :::*                    LISTEN      5102/dnsmasq
udp        0      0 0.0.0.0:2049            0.0.0.0:*                           -
udp        0      0 0.0.0.0:32777           0.0.0.0:*                           -
udp        0      0 0.0.0.0:32778           0.0.0.0:*                           5172/rpc.statd
udp        0      0 0.0.0.0:32780           0.0.0.0:*                           5170/rpc.mountd

udp        0      0 0.0.0.0:53              0.0.0.0:*                           5102/dnsmasq
udp        0      0 0.0.0.0:67              0.0.0.0:*                           5102/dnsmasq
udp        0      0 0.0.0.0:1900            0.0.0.0:*                           3399/minidlna
udp        0      0 0.0.0.0:111             0.0.0.0:*                           5139/portmap
udp        0      0 127.0.0.1:684           0.0.0.0:*                           5172/rpc.statd
udp        0      0 192.168.2.1:33234       0.0.0.0:*                           3399/minidlna
udp        0      0 :::546                  :::*                                3741/odhcp6c
udp        0      0 :::546                  :::*                                2952/odhcp6c
udp        0      0 :::547                  :::*                                2776/odhcpd
udp        0      0 :::53                   :::*                                5102/dnsmasq

猜测
猜测1:我无法判断NFS服务端的版本,如果是NFS3,那么它是不支持用户验证的,OpenWRT的LCUI中的配置页面中有PRCD的配置,字段描述一个是NFS_SERVER用户名,一个是NFS_SERVER密码。怀疑是不是和这个配置文件有关。。。

猜测2:参见OpenWRT官方NFS配置文档,其中提到
Problems

If the loopback device support is missing, an error like "Cannot register service: RPC: Timed out" may appear. Installing the kmod-loop package should solve this issue

错误消息有些不同,但是不排除可能是这个原因。现在的OpenWRT确实没有kmod-loop,官方的不能装。

故障排除
虽然最初认为是固件或者rpc.mountd有问题,但是在 zhouruixi 的帮助下,我发现OpenWRT本身支持NFS应该是没问题的。在坚持了两天的不断搜寻相关帖子的过程中,所有迹象都指向了防火墙或者网络设备本身
防火墙方面,iptables端口全开也不能排除故障,最后唯有网络了。由于我的网络环境中,所有设备都经过一个思科交换机连接到OpenWRT路由器,结果尝试直连后竟然奇迹般的成功了~~
折腾了将近4天时间,最后快放弃时竟然成功了。无比激动~~
我的恩山、我的无线 The best wifi forum is right here.
本帖最后由 zhouruixi 于 2016-4-24 13:36 编辑

在/tmp下建立个目录用来挂载,参数用nolock  试一下
我mount -t nfs -o nolock 10.0.0.254:/mnt/file_CC/debian_new nfs/ 成功,服务器为debian8
op为CC r49097
额,你是说op做服务器?
那么共享目录设置为/mnt等无法启动服务,你去/tmp建立个文件夹来共享,挂载时也要使用nolock参数


总之nolock参数必不可少,不论op做服务器还是客户端

点评

非常感谢快速回复。我服务端是OpenWRT(因为打算挂硬盘在路由器上),客户端使用nolock选项后,仍然是超时。  详情 回复 发表于 2016-4-24 16:37
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
zhouruixi 发表于 2016-4-24 13:30
在/tmp下建立个目录用来挂载,参数用nolock  试一下
我mount -t nfs -o nolock 10.0.0.254:/mnt/file_CC/d ...

非常感谢快速回复。我服务端是OpenWRT(因为打算挂硬盘在路由器上),客户端使用nolock选项后,仍然是超时。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

本帖最后由 zhouruixi 于 2016-4-24 19:46 编辑

为什么我是可以得呢?
我的debian在op的lan里面,你可以试下能不能成功,用以排除防火墙的原因
OP为NFS server
root@OpenWrt:/tmp/nfs# cat /etc/exports
/tmp/nfs        *(ro,all_squash,fsid=0,insecure,sync,no_subtree_check)


debian8作为client
root@debian:/tmp# showmount -e 10.0.0.1
Export list for 10.0.0.1:
/tmp/nfs *
root@debian:/tmp# mount -t nfs -o nolock -v 10.0.0.1:/tmp/nfs 00/
mount.nfs: timeout set for Sun Apr 24 19:44:51 2016
mount.nfs: trying text-based options 'nolock,vers=4,addr=10.0.0.1,clientaddr=10.0.0.254'
mount.nfs: mount(2): Protocol not supported
mount.nfs: trying text-based options 'nolock,addr=10.0.0.1'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 10.0.0.1 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 10.0.0.1 prog 100005 vers 3 prot UDP port 32780

root@debian:/tmp# cd 00/
root@debian:/tmp/00# ls
454  dsfas  sda656

你别用luci了,不支持用户认证的,直接一行配置完事了

点评

请问你用的OpenWRT版本(谁编译的,版本号等)。我用的是明月编译的春季版。已经试过CC和BB的,都是同样的问题。 多谢!  详情 回复 发表于 2016-4-25 16:48
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
zhouruixi 发表于 2016-4-24 19:36
为什么我是可以得呢?
我的debian在op的lan里面,你可以试下能不能成功,用以排除防火墙的原因
OP为NFS s ...

请问你用的OpenWRT版本(谁编译的,版本号等)。我用的是明月编译的春季版。已经试过CC和BB的,都是同样的问题。 多谢!

点评

自编译CHAOS CALMER (Chaos Calmer, r49097)  详情 回复 发表于 2016-4-26 06:22
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

mvsqr2 发表于 2016-4-25 16:48
请问你用的OpenWRT版本(谁编译的,版本号等)。我用的是明月编译的春季版。已经试过CC和BB的,都是同样 ...

自编译CHAOS CALMER (Chaos Calmer, r49097)

点评

多谢!我已经搞定了,是中间的交换机有问题,直连路由器就能成功mount 我差不多都放弃了,多谢你帮我试了下,让我确信OpenWRT的NFS是可以用的。  详情 回复 发表于 2016-4-26 14:39
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| | 显示全部楼层
zhouruixi 发表于 2016-4-26 06:22
自编译CHAOS CALMER (Chaos Calmer, r49097)

多谢!我已经搞定了,是中间的交换机有问题,直连路由器就能成功mount

我差不多都放弃了,多谢你帮我试了下,让我确信OpenWRT的NFS是可以用的。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

我输入/etc/init.d/nfsd 后显示:
rpc.nfsd:unable to bind inet TCP socket:error 125(Address already in use)
rpc.nfsd:unable to set any sockets for nfsd.
我的/etc/exports文件中:
/mnt/sda1        *(rw,sync,no_subtree_check)
这是怎么回事?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

你好,编译的lede固件,system log里提示以下错误:
Tue Feb  7 23:01:51 2017 kern.warn kernel: [   21.835863] svc: failed to register lockdv1 RPC service (errno 97).

/etc/exports设置如下
/mnt/sda1       192.168.1.0/255.255.255.0(rw,sync,no_subtree_check)

请问如何设置才能避免上述错误提示?谢谢。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

欢迎大家光临恩山无线论坛上一条 /1 下一条

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-28 13:05

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表