NFS Server and client configuration Centos

NFS Server side configuration

Create directory which you want to share

mkdir -p /nfsshare

yum install nfs-utils rpcbind nfs-utils-lib

chkconfig rpcbind on

chkconfig nfs on

chkconfig nfslock on

service rpcbind start

service nfs start

or

/etc/init.d/nfs start

service nfslock start

define allowed IPs on server

lets suppose

Server IP : a.a.a.a

Client IP : b.b.b.b

vi /etc/hosts.allow

mountd: 127.0.0.1 b.b.b.b

mkdir -p /nfsshare

chown -R nfsnobody.nfsnobody /nfsshare

chmod -R 750 /nfsshare

or

chown -R 65534:65534 /nfsshare

chmod -R 755 /nfsshare

vi /etc/exports

/nfsshare           b.b.b.b(rw,sync,no_root_squash,no_subtree_check)

or

/nfsshare   b.b.b.b/255.255.255.255(rw,sync,no_wdelay,all_squash)

exportfs -a

service nfs restart

 

(The no_root_squash option makes that /home will be accessed as root.) you may skip this for non root directories

 

NFS Client side configurations

yum install nfs-utils nfs-utils-lib

Make sure portmapper is running other wise its authenticate but give errors like this

chkconfig –list | grep portmap

To start it on centos and set it to start at boot

service portmap start

chkconfig portmap on

mkdir -p /mnt/nfsshare

mount a.a.a.a:/nfsshare  /mnt/nfsshare

vi /etc/fstab

a.a.a.a:/nfsshare /mnt/nfsshare nfs rw,sync,hard,intr 0 0

df -h

mount

Degubbing

rpcinfo -p

program vers proto   port
    100000    2   tcp    111  portmapper
    100024    1   udp  36849  status
    100024    1   tcp  47263  status
    100000    2   udp    111  portmapper
    100021    1   udp  34940  nlockmgr
    100021    3   udp  34940  nlockmgr
    100021    4   udp  34940  nlockmgr
    100021    1   tcp  60818  nlockmgr
    100021    3   tcp  60818  nlockmgr
    100021    4   tcp  60818  nlockmgr
    100003    2   tcp   2049  nfs
    100003    3   tcp   2049  nfs
    100003    4   tcp   2049  nfs
    100003    2   udp   2049  nfs
    100003    3   udp   2049  nfs
    100003    4   udp   2049  nfs
    100005    1   udp  52727  mountd
    100005    1   tcp  42462  mountd
    100005    2   udp  52727  mountd
    100005    2   tcp  42462  mountd
    100005    3   udp  52727  mountd
    100005    3   tcp  42462  mountd


netstat -ntlp | grep 111


stop your firewall and disable the selinux

Code:
#/etc/init.d/iptables stop
Code:
#vi /etc/sysconfig/selinux
selinux=disabled
these two services should be running on server

Code:
#rpcinfo -p
100021    4    tcp6      ::.157.164             nlockmgr   unknown
100000    4    tcp6      ::.0.111               portmapper superuser


cat /var/log/messages|grep nfs

can you try mounting using this command and make sure portmap service is running on server

Code:
mount -t nfs -v a.a.a.a:/nfsshare /mnt/nfsshare
and post the last log messages related to nfs server
Code:
cat /var/log/messages

Related Posts