The Network File Systems (NFS) protocol works great when it comes to Linux systems because it allows for client flexibility, centralized management of files, and some other great features.
A-Installing Packages.
# yum install -y nfs-utils nfs4-acl-tools
Important configuration files:
/etc/sysconfig/nfs Contains the main config files for the NFS service
/etc/exports Contains a list of resources that will be exported to
clients
/var/lib/nfs/etab Contains a list of currently exported resources
/var/lib/nfs/rmtab Contains a list of remotely mounted resources
------------------------------------------------------------------------------------------------------
Now add data that you want to share on the network and set other options.
The syntax of the /etc/exports file is
<mountpoint> <host><permissions/options>
# vim /etc/exports
/sharedata *.*(rw,sync)
It means i want to share my /sharedata directory to any network with read and write permissoin along with sychronization enabled.
Now restart and on required services
# service nfs restart
# service rpcbind restart
# service xinetd restart
# service nfslock start
# chkconfig nfs on
# chkconfig nfslock on
# chkconfig rpcbind on
Here is what a manual export of resources would look like:
# exportfs -avr
exporting *:/home
This command is used to verify that all the parts of the NFS service are running properly.
#rpcinfo -p
Use iptables to create the additional firewall rules:
# iptables -I INPUT -p tcp -m tcp --dport 2049 -j ACCEPT
# getsebool -a | grep nfs
Troubleshooting NFS commands:
#mountstats Shows information about mounted NFS shares
#nfsstat Shows statistics of exported resources
#nfsiostat Shows statistics of NFS mounted shares
View exported resources (whether or not they are mounted):
# cat /var/lib/nfs/etab
Connect from client
# yum install -y nfs-utils nfs4-acl-tools
# chkconfig rpcbind on
# mount –t nfs 172.168.1.1:/shareddata /mnt/mountpoint
#cd /mnt/mountpoint
#ls
Here you will see file that you have shared through nfs.
No comments:
Post a Comment