一、场景:
在Linux上操作命令:
host3:/opt/oracle # id
uid=0(root) gid=0(root) groups=0(root),64(pkcs11)
host3:/opt/oracle # mount -t nfs 192.168.1.73:/opt/oracle/backup /opt/oracle/backup
mount server reported tcp not available, falling back to udp
mount: RPC:程序未注册
host3:/opt/oracle #
二、分析步骤:
第1步:检查对方服务器是否做了连接限制
登录到对方服务器 , 查看/etc/hosts.allow 和 /etc/hosts.deny 文件.其中hosts.deny 是拒绝了其中对应IP的主机的连接,hosts.allow 是允许其中对应IP主机的连接。
[root@hua73 ~]# tail /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.
#
[root@hua73 ~]# tail /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!
从里面内容可知,对方服务并未对他方主机的连接做任何限制。
第2步:是否是由相关服务未启动导致:
检查portmap服务、nfs服务。其中portmap服务是用来支持RPC连接,RPC被用于NFS以及NIS 等服务。
1、检查portmap服务的状态:
[root@hua73 ~]# service portmap status
portmap (pid 3285) is running...
说明portmap服务正常启动运行。
2、检查nfs服务的状态:
[root@hua73 ~]# service nfs status
rpc.mountd is stopped
nfsd is stopped
rpc.rquotad is stopped
——nfs服务未启动。
三、解决方法:
1、启动nfs服务:
[root@hua73 ~]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
2、重启portmap服务:
[root@hua73 ~]#
[root@hua73 ~]# service portmap reload
Stopping portmap: [ OK ]
Starting portmap: [ OK ]
[root@hua73 ~]#
但执行命令还是不行:
host3:/opt/oracle # mount -t nfs 192.168.1.73:/opt/oracle/backup /opt/oracle/backup
mount: 192.168.1.73:/opt/oracle/backup failed, reason given by server: Permission denied
最后在exports中增加一行才解决问题
[root@hua73 etc]# vi exports
/opt/oracle/backup 192.168.1.53(rw,root_squash,sync)
~
~
~
~
~
~
~
"exports" 1L, 53C written
[root@hua73 etc]# service iptables status
Firewall is stopped.
[root@hua73 etc]#
[root@hua73 etc]#
[root@hua73 etc]#
[root@hua73 etc]#
[root@hua73 etc]#
[root@hua73 etc]#
[root@hua73 etc]# servicd nfs restart
-bash: servicd: command not found
[root@hua73 etc]# service nfs restart
Shutting down NFS mountd: [ OK ]
Shutting down NFS daemon: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [FAILED]
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
[root@hua73 etc]# cat exports
/opt/oracle/backup 192.168.1.53(rw,root_squash,sync)
[root@hua73 etc]# ls -l exports
-rw-r--r-- 1 root root 53 Dec 12 10:44 exports
[root@hua73 etc]# date
Thu Dec 12 10:55:27 CST 2013
[root@hua73 etc]#