Chinaunix

标题: NFS挂载超时 mount.nfs: Connection timed out [打印本页]

作者: howandsen    时间: 2014-01-28 22:07
标题: NFS挂载超时 mount.nfs: Connection timed out
本帖最后由 howandsen 于 2014-01-28 22:09 编辑

台式机和笔记本都是Fedora 20,想用NFS共享数据。台式机(主机名localhost)作为NFS server,笔记本(主机名Emma)为client。
但是现在出现一个问题,client挂载目录总是连接超时,
  1. [root@Emma Dotcra]# mount -t nfs 192.168.1.102:/home/Dotcra Legacy/
  2. mount.nfs: Connection timed out
复制代码
家里通过宽带路由器共享上网,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/exports内容如下,
  1. /home/Dotcra        192.168.1.*(rw)
复制代码
  1. [root@localhost ~]# exportfs -r
复制代码
未报错。
rpcbind与nfs服务都工作正常:

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

  9. [root@localhost ~]# systemctl status nfs
  10. nfs-server.service - NFS Server
  11.    Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; disabled)
  12.    Active: active (exited) since Tue 2014-01-28 18:39:34 CST; 1h 2min ago
  13.   Process: 1695 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=0/SUCCESS)
  14.   Process: 1691 ExecStop=/usr/sbin/rpc.nfsd 0 (code=exited, status=0/SUCCESS)
  15.   Process: 1734 ExecStartPost=/usr/libexec/nfs-utils/scripts/nfs-server.postconfig (code=exited, status=0/SUCCESS)
  16.   Process: 1719 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS $RPCNFSDCOUNT (code=exited, status=0/SUCCESS)
  17.   Process: 1715 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
  18.   Process: 1713 ExecStartPre=/usr/libexec/nfs-utils/scripts/nfs-server.preconfig (code=exited, status=0/SUCCESS)
  19. Main PID: 1719 (code=exited, status=0/SUCCESS)
  20.    CGroup: /system.slice/nfs-server.service
复制代码
selinux设为permissive,停止iptables,重启服务:

  1. [root@localhost ~]# setenforce 0
  2. [root@localhost ~]# systemctl stop iptables
  3. [root@localhost ~]# systemctl restart rpcbind
  4. [root@localhost ~]# systemctl restart nfs
复制代码
一系列动作后,依旧超时,会是什么问题呢?
作者: securitypluscn    时间: 2014-01-29 02:33
showmount -e 的提示是什么?

作者: howandsen    时间: 2014-01-29 10:57
本帖最后由 howandsen 于 2014-01-29 12:08 编辑

回复 2# securitypluscn
  1. [root@localhost ~]# showmount -e
  2. Export list for localhost.localdomain:
  3. /home/Dotcra 192.168.1.*
  4. [root@Emma ~]# showmount -e 192.168.1.102
  5. clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)
复制代码

作者: securitypluscn    时间: 2014-01-29 23:31
本帖最后由 securitypluscn 于 2014-01-29 23:57 编辑

回复 3# howandsen


试试在/etc/sysconfig/nfs 中uncomment mount_port 892。 再在防火墙上打一个892TCP的洞。重启IPTABLES和其他的相关服务后用showmount 和 mount 命令试试。如不行,把错误信息,IPTABLES 和LOG FILE 的内容贴上来看看。


   
作者: howandsen    时间: 2014-01-31 19:16
回复 4# securitypluscn

果然还是防火墙的事,但有一点被忽略了——现在Fedora的默认防火墙是firewalld而非iptables。iptables默认就是不启动的。
systemctl stop firewalld就好了。
systemctl start/stop/restart 没有反馈信息,不然应该能早发现的。
谢谢了。新年快乐。
   
作者: securitypluscn    时间: 2014-02-01 00:03
本帖最后由 securitypluscn 于 2014-02-01 00:08 编辑

回复 5# howandsen

我这几天也为FEDORA的防火墙郁闷着呢。刚刚开始用FEDORA19.以前没用过FIREWALLD 和SYSTEMD。


   




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2