1. 程式人生 > >SuSE linux NFS掛載失敗案例處理:mount.nfs: access denied

SuSE linux NFS掛載失敗案例處理:mount.nfs: access denied

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

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做網段匹配。

-- Bosco  QQ:375612082

---- END ----
-------------------------------------------------------------------------------------------------------
版權所有,文章允許轉載,但必須以連結方式註明源地址,否則追究法律責任!