1. 环境描述
NFS server和NFS client操作系统版本:
-
bidw2:~ # cat /etc/SuSE-release
-
SUSE Linux Enterprise Server 11 (x86_64)
-
VERSION = 11
-
PATCHLEVEL = 1
-
bidw2:~ # uname -a
-
Linux bidw2 2.6.32.59-0.7-default #1 SMP 2012-07-13 15:50:56 +0200 x86_64 x86_64 x86_64 GNU/Linux
blog地址:http://blog.csdn.net/hw_libo/article/details/39521849
2. NFS client挂载时出现错误
-
bidw2:~ # mount -t nfs -o rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,vers=3,timeo=600,actimeo=0 192.168.142.60:/filedir /filedir
-
mount.nfs: access denied by server while mounting 192.168.142.60:/filedir
经确认过,防火墙都是关闭的,网络是正常的:
-
bidw2:~ # showmount -e 192.168.142.60
-
Export list for 192.168.142.60:
-
/filedir 192.168.142.*
在NFS server的messages日志中有这样的提示:
-
Sep 24 12:57:37 bidw1 mountd[17400]: refused unmount request from 192.168.142.61 for /filedir (/filedir): unmatched host
-
Sep 24 12:57:55 bidw1 mountd[17400]: refused mount request from 192.168.142.61 for /filedir (/filedir): unmatched host
NFS server的/etc/exports配置如下:
-
bidw1:~ # cat /etc/exports
-
/filedir 192.168.142.*(rw,no_root_squash,sync)
这种配置,我在SuSE 10 sp1/sp2的系统中都做过配置,NFS都是可以正常使用的,也可以正常挂载,为什么到了SuSE 11后就不行了呢?
3. 解决办法
根据以往碰到这类问题的经验,我将NFS server的配置调整为:
-
bidw1:~ # cat /etc/exports
-
/filedir 192.168.142.0/24(rw,no_root_squash,sync)
然后重启了下NFS server:
bidw1:~ # rcnfsserver restart
再次在NFS client中进行挂载NFS时,发现挂载成功了:
-
bidw2:~ # mount -t nfs -o rw,bg,hard,nointr,rsize=32768,wsize=32768,tcp,vers=3,timeo=600,actimeo=0 192.168.142.60:/filedir /filedir
-
bidw2:~ # df -h
-
Filesystem Size Used Avail Use% Mounted on
-
/dev/sda1 127G 43G 78G 36% /
-
devtmpfs 109G 5.0M 109G 1% /dev
-
tmpfs 64G 26G 38G 42% /dev/shm
-
/dev/sda3 30G 309M 28G 2% /home
-
/dev/sda2 50G 498M 47G 2% /opt
-
/dev/sda6 50G 18G 30G 37% /opt/oracle
-
192.168.142.60:/filedir
-
1.5T 316G 1.1T 23% /filedir
总结:
或许在SuSE 11系统中,已经不能使用通匹符*做匹配了,只能做精确匹配,或时使用192.168.142.0/24做网段匹配。
问题1:
[root@sftspstapp10 ~]# mount -t nfs 10.244.164.42:/opt/data1 /data1
mount.nfs: access denied by server while mounting 10.244.164.42:/opt/data1
查看问题1:/var/log/messages
Aug 14 19:31:57 sftspstapp08 kernel: svc: 10.244.167.148, port=755: unknown version (4 for prog 100003, nfsd)
Aug 14 19:31:57 sftspstapp08 rpc.mountd[27516]: refused mount request from 10.244.167.148 for /opt/data1 (/opt/data1): unmatched host
解决方案1:
原因为:NFS Server 只添加10.244.164网段允许NFS 挂载,并没有添加其他网段可以挂载,所以NFS Server端需要添加允许其他特定网段可挂载NFS即可。
修改前
[root@sftspstapp08 opt]# more /etc/exports
/opt/data1 10.244.164.0/24(rw,sync)
修改后
[root@sftspstapp08 opt]# more /etc/exports
/opt/data1 10.244.164.0/24(rw,sync)
/opt/data1 10.244.167.0/24(rw,sync)
修改后,重启NFS Server
[root@sftspstapp08 opt]#sevice nfs restart