How to setup NFS server in AIX
This guide is recorded to help myself remember how to set up NFS service in AIX 7.1.Turn on NFS server service
The easier way is to use smitty.root@myserver:/> smitty nfs
Select "Network File system NFS"
Select "Configure NFS on This System"
Go to the "Start NFS" menu
Decide if you want NFS to start up automatically after each reboot. I selected "both" as i want it online all the time.
Done. You may see some output, unless there are any errors, you may want to check the NFS configurations otherwise, just see the "OK" status on the top left hand corner.
You should now have some services listening for NFS, like nfs and mountd processes
root@myserver:/> rpcinfo -p program vers proto port service 100000 4 udp 111 portmapper 100000 3 udp 111 portmapper 100000 2 udp 111 portmapper 100000 4 tcp 111 portmapper 100000 3 tcp 111 portmapper 100000 2 tcp 111 portmapper 100003 2 udp 2049 nfs 100003 3 udp 2049 nfs 100003 2 tcp 2049 nfs 100003 3 tcp 2049 nfs 100003 4 tcp 2049 nfs 200006 1 udp 2049 200006 4 udp 2049 200006 1 tcp 2049 200006 4 tcp 2049 100005 1 tcp 32768 mountd 100005 2 tcp 32768 mountd 100005 3 tcp 32768 mountd 100005 1 udp 32772 mountd 100005 2 udp 32772 mountd 100005 3 udp 32772 mountd 400005 1 udp 32773 100024 1 tcp 32769 status 100024 1 udp 32779 status 100133 1 tcp 32769 100133 1 udp 32786 200001 1 tcp 32769 200001 1 udp 32793 200001 2 tcp 32769 200001 2 udp 32800 100021 1 udp 32803 nlockmgr 100021 2 udp 32803 nlockmgr 100021 3 udp 32803 nlockmgr 100021 4 udp 32803 nlockmgr 100021 1 tcp 32770 nlockmgr 100021 2 tcp 32770 nlockmgr 100021 3 tcp 32770 nlockmgr 100021 4 tcp 32770 nlockmgr
The file "/etc/rc.nfs" is used to control what NFS / NIS services can be started up. |
Adding a directory into NFS service.
Method 1: use smittyStart up smitty like above then go to the "Add a Directory to Exports List" menu.
Fill up the Pathname of directory to export, leave UID as "-2", set the NFS version (i used 3 as this is the best version i think all my servers can talk), then set which accounts from which servers can access this directory.
Method 2: use the CLI way.
Edit the exports file
root@myserver:/> more /etc/exports /opt/myfolder/data -sec=sys:krb5p:krb5i:krb5:dh,rw,root=myserver /opt/myfolder/binaries -sec=sys:krb5p:krb5i:krb5:dh,ro=myserver,root=myserver
AIX
is very strict on who can access the partition, so make sure you add in
who can mount the partition, i.e. root otherwise, you will not be able
to mount the partition. Also ensure that both NFS server and client can use the same security protocol, otherwise the result is same as above. Lastly, put in explicitly who can read-write or read-only to control access. |
Make sure that both the server and client end has each other's hostname and IP in the hosts files otherwise the next step will fail.
then restart the exports service
exportfs -a
Now we check and confirm NFS is shared as we want it.
root@myserver:/> exportfs /opt/myfolder/data -sec=sys:krb5p:krb5i:krb5:dh,rw,root=myserver /opt/myfolder/binaries -sec=sys:krb5p:krb5i:krb5:dh,ro=myserver,root=myserver
If you are sharing between AIX and Solaris or Linux, use NFS version 3 for now to have full compatibility. For AIX NFS server, set in "Allow Access by NFS versions" entry. For Solaris client, mount with "-o vers=3" option. |
No comments:
Post a Comment