NFS Server without firewall

server ip = 192.168.1.13

client ip 192.168.1.10

Stop firewall and disable selinux

service iptables stop
chkconfig iptables off

setenforce 0

vi /etc/sysconfig/selinux
SELINUX=disabled

Server

  • install
yum install nfs-utils nfs-utils-lib
  • start service and use chkconfig
service rpcbind start
chkconfig rpcbind on
service nfs start
chkconfig nfs on
service nfslock start
chkconfig nfslock on

  • make  an export share
mkdir /share
  • add entry in exports file
vi /etc/exports
/share     *(rw,sync,no_root_squash)

 

service rpcbind restart
service nfs restart
service nfslock restart

To check if it is exporting the files or not we can do

[root@linuxinstall ~]# exportfs
/share <world>

or

[root@linuxinstall ~]# showmount -e localhost
Export list for localhost:
/share *
[root@linuxinstall ~]# showmount -e 192.168.7.252
Export list for 192.168.7.252:
/share *

 

Setting Up the NFS Client

 

  • install packages
yum install nfs-utils rpcbind
  • start service and use chkconfig
service rpcbind start
chkconfig rpcbind on
service nfs start
chkconfig nfs on
service nfslock start
chkconfig nfslock on
  • create directory that will contain /share
mkdir /nfsshare
  • check with rpc and showmount command

 

rpcinfo -p 192.168.1.13
showmount -e 192.168.1.13
  • if both command working go ahead and mount
mount -t nfs 192.168.1.13:/share /nfsshare
  • check if its mounted or not
df -h 

mount -s
cat /proc/mounts
  • make it permanent by adding it in fstab
192.168.1.13:/share   /nfsshare  nfs   defaults  0 0

 

  • to unmount
umount /nfsshare
if it is in fstab dont forget to delete the enety from fstab

 

link o video <- click here

link to enable nfs with firewall <- click here

 

 

leave comment