Server Side-
set repository ( if you are using RHEL-5)
# yum install nfs*
# yum install nfslock
# yum install portmap*
now restart all services
# /etc/init.d/nfs restart
# /etc/init.d/portmap restart
# /etc/init.d/nfslock restart
# chkconfig nfs on
# chkconfig portmap on
Make directory for share in network.
# mkdir /data
give permission as per your user management.
# chmod -R 777 /data (full permission)
Open /etc/exportfs file & edit this file.
# vim /etc/exportfs
/data *. 192.168.10.0/24(rw,sync)
file save in exit.
ro: The directory is shared read only; the client machine will not be able to write it. This is the default.
rw: The client machine will have read and write access to the directory.
sync: By default, all but the most recent version (version 1.11) of the exportfs command will use async behaviour.
# /etc/init.d/iptables start
open vim /etc/sysconfig/nfs & add following line for set port for nfs in iptables running mode.
MOUNTD_PORT="4002"
STATD_PORT="4003"
LOCKD_TCPPORT="4004"
LOCKD_UDPPORT="4004"
save & exit file.
# iptables -I INPUT -s 192.168.10.0/24 -p tcp --dport 111 -j ACCEPT
# iptables -I INPUT -s 192.168.10.0/24 -p tcp --dport 2049 -j ACCEPT
# iptables -I INPUT -s 192.168.10.0/24 -p tcp --dport 4002 -j ACCEPT
# iptables -I INPUT -s 192.168.10.0/24 -p tcp --dport 4003 -j ACCEPT
# iptables -I INPUT -s 192.168.10.0/24 -p tcp --dport 4004-j ACCEPT
# iptables -I INPUT -s 192.168.10.0/24 -p udp --dport 111 -j ACCEPT
# iptables -I INPUT -s 192.168.10.0/24 -p udp --dport 4002 -j ACCEPT
# iptables -I INPUT -s 192.168.10.0/24 -p udp --dport 4003 -j ACCEPT
# iptables -I INPUT -s 192.168.10.0/24 -p udp --dport 4004 -j ACCEPT
# iptables -I INPUT -s 192.168.10.0/24 -p udp --dport 2049 -j ACCEPT
# /etc/init.d/iptables save
# /etc/init.d/iptables restart
# /etc/init.d/nfs/restart
# showmount -e 192.168.10.10
It will be display share directory.
(note 192.168.100.10 - nfs configuration server ip )
Client Side-:
start portmap or nfs services.
/etc/init.d/nfs/restart
/etc/init.d/portmap restart
Mount nfs share directory temparly
mount -t nfs 192.168.10.10:/data /mnt
if you want to mount permanatly then open file vim /etc/fstab file & add this line.
# vim /etc/fstab
192.168.10.10:/data /mnt nfs defaults 0 0
Then file save & exit
# umount -a
# mount -a
# df -kh
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 73G 5.9G 63G 9% /
tmpfs 248M 124K 248M 1% /dev/shm
gvfs-fuse-daemon 73G 5.9G 63G 9% /root/.gvfs
192.168.10.10:/data
97G 77G 21G 80% /mnt
Enjoy...........................
No comments:
Post a Comment