AIX7.1 配置 NFS笔记

服务器AIX 7.1, 地址:10.72.254.101
客户端Redhat6 地址: 10.72.254.198

1 首先确认nfs服务正常运行。(Aix 下nfs所需服务:portmap, nfsd, biod, rpc.lockd, rpc.statd, rpc.mountd)

lssrc -s portmap    # 查看portmap服务情况
lssrc -g nfs        # 查看NFS服务情况
mknfs -N        # 启动nfs服务
startsrc -g nfs     # 启动nfs服务
smit mknfs      # 启动nfs服务
rmnfs           # 关闭nfs
smit rmnfs      # 停止nfs服务 

2 配置/etc/exports 文件
smitty nfs ==> Add Directory… ==> 添加路径和计算名或IP。

cat /etc/exports  # 显示如下:
/bak -sec=sys:krb5p:krb5i:krb5:dh,rw=10.72.254.198,access=10.72.254.198,root=10.72.254.198
exportfs -a    # 导出exports到 xtab,rpc.mountd 会读取/etc/xtab文件

经过以上步骤,至客户端执行 showmount -e 10.72.254.101可显示出来了。

3 客户端配置
mount -t nfs 10.72.254.101:/bak /mnt 显示 Remote server I/O error.经查,是由于Linux与Aix所用的NFS版本问题,指定版本即可

mount -t nfs -o vers=3 -v 10.72.254.101:/bak /mnt 
显示如下:
mount.nfs: timeout set for Wed Feb 15 15:11:13 2017
mount.nfs: trying text-based options 'vers=3,addr=10.72.254.31'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 10.72.254.31 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying 10.72.254.31 prog 100005 vers 3 prot UDP port 62082
mount.nfs: mount(2): Permission denied
mount.nfs: access denied by server while mounting 10.72.254.31:/bak

通过显示 客户端通过UDP连接被拒绝,baidu了很久也得不到有效的解决方法。权限方面设置确定没有问题,采用tcp 连接试一下:

mount -t nfs -v -o vers=3 -o proto=tcp 10.72.254.31:/bak /mnt  #显示如下:
##
mount.nfs: timeout set for Wed Feb 15 15:24:09 2017
mount.nfs: trying text-based options 'vers=3,proto=tcp,addr=10.72.254.31'
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying 10.72.254.31 prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=6
mount.nfs: trying 10.72.254.31 prog 100005 vers 3 prot TCP port 57476
mount.nfs: mount(2): Permission denied
mount.nfs: access denied by server while mounting 10.72.254.31:/bak

同样的显示表明 与协议无关。

http://blog.chinaunix.net/uid-20554957-id-3444786.html 他的这个问题给了我一些启示,但AIX下的配置有些不同,没有这些选项,这里的端口问题也不适合这个情况。
其中调了很多地方,setenforce 关闭SELinux,/etc/init.d/iptables stop停止iptables…… 等等, 都没有改善这种问题。

google了一翻,也没有找到合适的解决方法,其中也看到一些比较好的不同问题解决方法:
http://www.linuxquestions.org/questions/linux-server-73/nfs-access-denied-by-server-while-mounting-934161/

这个是IBM官方文档中的一些 mount error messages
https://www.ibm.com/support/knowledgecenter/en/ssw_aix_71/com.ibm.aix.networkcomm/nfs_mountmessages.htm

在这中间多次提示到服务器端配置 /etc/hosts, 那就将客户端的 hostname 添加进去,保证ping hostname 可以通过。OK, 再次mount 可以了。

服务端 /etc/hosts配置如下:

127.0.0.1               loopback localhost      # loopback (lo0) name/address
10.72.254.31    test-app
10.72.254.198   dzqz

客户端/etc/hosts 配置:

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.72.254.31    test-app

最用采用hostname mount ..

mount -t nfs -o vers=3 test-app:/bak /mnt 一切正常。

aix官方的文档:https://www.ibm.com/support/knowledgecenter/ssw_aix_71/com.ibm.aix.networkcomm/nfs_intro.htm

NFS commands :

Item    Description
chnfs   Starts a specified number of biod and nfsd daemons.
chnfsdom    Changes the local NFS domain.
chnfsim Changes NFS foreign identity mappings.
chnfssec    Changes the default security flavor used by the NFS client
chnfsrtd    Changes the local NFS realm-to-domain mappings.
mknfs   Configures the system to run NFS and starts NFS daemons.
nfso    Configures NFS network options.
automount   Mounts an NFS file system automatically.
chnfsexp    Changes the attributes of an NFS-exported directory.
chnfsmnt    Changes the attributes of an NFS-mounted directory.
exportfs    Exports and unexports directories to NFS clients.
lsnfsexp    Displays the characteristics of directories that are exported with NFS.
lsnfsmnt    Displays the characteristics of mounted NFS systems.
mknfsexp    Exports a directory using NFS.
mknfsmnt    Mounts a directory using NFS.
nfshostkey  Configure the host key for an NFS server.
nfs4cl  Displays information about filesystems a client is accessing using NFS version 4.
nfs4smctl   Administers revocation of NFS version 4 State
rmnfs   Stops the NFS daemons.
rmnfsexp    Removes NFS-exported directories from a server's list of exports.
rmnfsmnt    Removes NFS-mounted file systems from a client's list of mounts.

走过的弯路,主要还是前期对文档没有仔细查看,很多文档都在前面提到配置/etc/hosts。但Linux可以不用配置可以直接使用,但Aix就必须要配置。

你可能感兴趣的:(运维)