mount:RPC:Unable to receive;errno=No route to host

 1:首先确保自己已经安装有nfs服务,测试方式可以为: 

#service nfs status 

没有unrecognized service之类的错误输出就表示已经安装 


 2:编辑配置文件/etc/exports,内容简单的可以为:

 /home *(rw) 

也可以配置更多的参数,如/home/work 192.168.1.*(rw,sync,no_root_squash) 

添加的内容表示:允许ip 地址范围在192.168.1.*的计算机以读写的权限来访问/home/work 目录。

 括号内的参数意义描述如下:

 rw:读/写权限,只读权限的参数为ro; 

sync:数据同步写入内存和硬盘,也可以使用async,此时数据会先暂存于内存中,而不立即写入硬盘。 

no_root_squash:NFS 服务器共享目录用户的属性,如果用户是 root,那么对于这个共享目录来说就具有 root 的权限。  


3:重启或者启动对应的两个服务: 

[root@localhost n300]# service portmap restart 

Stopping portmap:         [ OK ] 

Starting portmap:             [ OK ] 

[root@localhost n300]# service nfs restart 

Shutting down NFS mountd:                                  [ OK ] 

Shutting down NFS daemon:                                  [ OK ] 

Shutting down NFS quotas:                                  [ OK ] 

Shutting down NFS services:                                [ OK ] 

Starting NFS services:                                     [ OK ] 

Starting NFS quotas:                                       [ OK ] 

Starting NFS daemon:                                       [ OK ] 

Starting NFS mountd:                                       [ OK ] 

4:本机测试或者其他客户端的测试: 

>: mount -o nolock 10.78.28.103:/usr/n300 /mnt 

mount: RPC: Unable to receive; errno = No route to host 

mount: nfsmount failed: Bad file descriptor 

mount: Mounting 10.78.28.103:/usr/n300 on /mnt failed: Bad file descriptor 

 如果有上面类似错误,有可能是如下原因 

:先ping客户端能否连通服务器ip  

     RPC: Unable to receive; errno = No route to host 的原因 

b:nfs服务器是否有防火墙屏蔽了对应端口

       查看防火墙状态 service iptables status  

c:/etc/hosts.deny /etc/hosts.allow 是否屏蔽了客户端ip 

      Bad file descriptor的原因 

d:/etc/exports配置有问题,确保文件中的"()"是英文的,如果你从其他地方copy有可能 出现如上问题 

 解决办法: 

[root@localhost n300]# service iptables stop

 Flushing firewall rules:          [ OK ] 

Setting chains to policy ACCEPT: filter                    [ OK ]

 Unloading iptables modules:                                [ OK ]

 [root@localhost n300]# service iptables status 

Firewall is stopped. 

[root@localhost n300]# cat /etc/hosts hosts 

       hosts.allow hosts.deny

 [root@localhost n300]# cat /etc/hosts.deny 

# hosts.deny    This file describes the names of the hosts which are

 #               *not* allowed to use the local INET services, as decided 

#               by the '/usr/sbin/tcpd' server. 

# The portmap line is redundant, but it is left to remind you that # the new secure portmap uses hosts.deny and hosts.allow. In particular 

# you should know that NFS uses portmap!  [root@localhost n300]# cat /etc/hosts.allow 

# hosts.allow   This file describes the names of the hosts which are

 #               allowed to use the local INET services, as decided 

#               by the '/usr/sbin/tcpd' server.

 #  

5: 解决上面问题后应该可以正确的mount了

你可能感兴趣的:(mount:RPC:Unable to receive;errno=No route to host)