挂载NFS超时 mount.nfs: Connection timed out

Submitted by Dot on Mon, 01/27/2014 - 23:46

笔记本差不多配置好了,接下来的工作是把台式机里的数据转移过来,然后把台式机的Fedora换成Windows 7,留给爸妈用。i5 3450,4GB,Geforce GTX 560se,够他们用了。 台式机和笔记本都是Fedora 20,共享数据首选NFS。台式机(主机名localhost)作为NFS server,笔记本(主机名Emma)为client。 但是现在出现一个问题,client挂载目录总是连接超时,

[[email protected] Dotcra]# mount -t nfs 192.168.1.102:/home/Dotcra Legacy/
mount.nfs: Connection timed out
[[email protected] Dotcra]# showmount -e 192.168.1.102
clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)

家里通过宽带路由器共享上网,DHCP分配IP,台式机有线连接,IP 192.168.1.102,笔记本用无线网卡,IP 192.168.1.104,两台主机能相互ping,且对台式机NFS server的配置均是在笔记本上通过ssh完成的。说明不是网络问题。 继续排查。 /etc/hosts.allow和/etc/hosts.deny里都无内容,/etc/sysconfig/nfs和/etc/nfsmount.conf都为默认,未改动; /etc/exports内容如下,

[[email protected] ~]# cat /etc/exports
/home/Dotcra        192.168.1.*(rw) 

[[email protected] ~]# exportfs -r 未报错。 rpcbind与nfs服务都工作正常(据说NFSv4也不用rpcbind了):

[[email protected] ~]# systemctl status rpcbind
rpcbind.service - RPC bind service
   Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; enabled)
   Active: active (running) since Tue 2014-01-28 18:39:33 CST; 1h 2min ago
  Process: 1704 ExecStart=/sbin/rpcbind -w ${RPCBIND_ARGS} (code=exited, status=0/SUCCESS)
 Main PID: 1705 (rpcbind)
   CGroup: /system.slice/rpcbind.service
           └─1705 /sbin/rpcbind -w

[[email protected] ~]# systemctl status nfs
nfs-server.service - NFS Server
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled)
   Active: active (exited) since Tue 2014-01-28 18:39:34 CST; 1h 2min ago
  Process: 1695 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=0/SUCCESS)
  Process: 1691 ExecStop=/usr/sbin/rpc.nfsd 0 (code=exited, status=0/SUCCESS)
  Process: 1734 ExecStartPost=/usr/libexec/nfs-utils/scripts/nfs-server.postconfig (code=exited, status=0/SUCCESS)
  Process: 1719 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS $RPCNFSDCOUNT (code=exited, status=0/SUCCESS)
  Process: 1715 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
  Process: 1713 ExecStartPre=/usr/libexec/nfs-utils/scripts/nfs-server.preconfig (code=exited, status=0/SUCCESS)
 Main PID: 1719 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/nfs-server.service

selinux设为permissive,停止iptables,重启服务:

[[email protected] ~]# setenforce 0
[[email protected] ~]# systemctl stop iptables
[[email protected] ~]# systemctl restart rpcbind
[[email protected] ~]# systemctl restart nfs

一系列动作后,问题依旧。 1月29日更新: google了几天也没找到解决办法,看来要当个课题来研究了。方便起见,今天在笔记本上用VirtualBox又装了个Fedora 20(主机名Sparks)作为NFS server,结果还是一样。 另外提一下,虚拟机配置好后,直接在上面运行不带IP的showmount会报错:

[[email protected] ~]$ showmount -e
clnt_create: RPC: Unknown host

经回忆,给这个虚拟系统改过/etc/hostname,但没有更新/etc/hosts,导致系统无法识别新主机名。将新主机名Sparks加入/etc/hosts就OK了。 1月30日更新: 这几天google了不少页面,有各种各样的说法,但提到最多的还是iptables。自己也觉得像是防火墙的问题,可就是纳闷为什么停了iptables也不管用。直到昨夜在GNOME里无意间看到了一个叫做Firewall的图标,点开发现Trusted services列表里未勾选nfs,便猜到一二。于是在Terminal里敲命令:[[email protected] ~]# systemctl stop firewalld.service,果然,可以成功mount了。 原来早在Fedora 15时就加入了firewalld,后来不知从哪个版本开始,直接取代iptables成了Fedora默认启用的防火墙,而iptables默认也不再启动。下面的命令也证实了这一点。笔记本新装的Fedora 20,history里显示没有关闭过iptables的自启动,而status里显示的状态已经是disabled了。

[[email protected] Dotcra]# history | grep iptables
  414  service iptables stop
  431  service iptables stop
  441  service iptables stop
  462  systemctl stop iptables
  486  systemctl stop iptables
  705  systemctl status iptables
  706  history | grep iptables
  755  history | grep iptables
  758  history | grep iptables
  759  iptables -p
  760  iptables 
  761  history | grep iptables
  762  iptables -L
  763  history | grep iptables
  769  history | grep iptables

[[email protected] Dotcra]# !705
systemctl status iptables
iptables.service - IPv4 firewall with iptables
   Loaded: loaded (/usr/lib/systemd/system/iptables.service; disabled)
   Active: inactive (dead)

systemctl start/stop/restart 没有反馈信息,否则在尝试systemctl stop iptables时应该就能发现。

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.