|
本帖最后由 mvsqr2 于 2016-4-30 14:14 编辑
设备:MW4530r
固件:OpenWrt Chaos Calmer 15.05.1 r49087
问题现象:mount NFS 不成功,但是可以showmount,防火墙已经开放nfs相关端口
以下先描述客户端错误和现象;再给出服务端(openwrt)的配置和日志;最后部分是我的一些猜测
希望大神能给些建议,谢谢!
客户端:错误和现象
客户端:测试showmount - 成功
- root@debian:~# showmount -e 192.168.2.1
- Export list for 192.168.2.1:
- /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应该不能用户验证的
- # /etc/exports
- /tmp/log 192.168.2.0/255.255.255.0(ro,fsid=0,all_squash,insecure,sync,no_subtree_check)
- # /etc/config/rpcd
- config login
- option username 'root'
- option password '$p$root'
- list read '*'
- 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天时间,最后快放弃时竟然成功了。无比激动~~
|
|