0% found this document useful (0 votes)
18 views

0-File Level Sharing

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

0-File Level Sharing

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Network File System (NFS):

It is a sun protocol now not exist and acquired by oracle, work now with win server
2012. It allows multiple clients to access the share.

People prefer NFS:


1. It is so easy in configuration
2. No overhead on the server
3. No more processing power
4. NFS has a lot of versions
5. Data can be secured via Kerberos Authentication.
6. Enable nfs version4 with access control list
7. NFS version 4 uses port 2049/tcp, NFS version 3 use rpcbind service to get
port number.
8. NFS Provides compatibility between its versions
9. Security option sec=sys or krb5p, if krb5p option used we have to add the
security key in file /etc/krb5.keytab

Sharing to client in /etc/exports file could be the following:

 * ==> available to anyone over network

 192.168.100.140(rw) ==> shared to single host

 *.example.com(rw) ==> only to this domains

 server[1-20].example.com(rw) ==> to this machines

 10.0.0.0/16(rw) ==> to this subnet

NFS Server Side


[root@srv1 ~]# mkdir /nfsshare/
[root@srv1 ~]# chmod 777 /nfsshare
[root@srv1 ~]# semanage fcontext -a -t public_content_rw_t "/nfsshare(/.*)?"
[root@srv1 ~]# restorecon -Rv /nfsshare/
[root@srv1 ~]# chown rpcuser:rpcuser /nfsshare/
[root@srv1 ~]# vim /etc/exports
[root@srv1 ~]# /nfsshare 192.168.10.0/24(rw,sync,no_root_squash)
[root@srv1 ~]# dnf install nfs-utils
[root@srv1 ~]# vim /etc/idmapd.conf
Domain = lab.local ==> line 5
[root@srv1 ~]# firewall-cmd --add-service=nfs --add-service=rpc-bind --add-
service=mountd –permanent
[root@srv1 ~]# firewall-cmd –reload
[root@srv1 ~]# systemctl enable --now rpcbind nfs-server
[root@srv1 ~]# showmount -e 192.168.10.25

NFS Client Side:


[root@client ~]# dnf install nfs-utils
[root@client ~]# vim /etc/idmapd.conf
[root@client ~]# showmount -e 192.168.10.25
[root@client ~]# mkdir /nfstest
[root@client ~]# mount -t nfs4 -o rw,sync 192.168.10.25:/nfsshare /nfstest
[root@client ~]# df -hT | grep nfs
192.168.10.25:/nfsshare nfs4 26G 4.4G 22G 17% /nfstest
[root@client ~]# mount | grep nfs4
192.168.10.25:/nfsshare on /nfstest type nfs4
(rw,relatime,sync,vers=4.2,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,time
o=600,retrans=2,sec=sys,clientaddr=192.168.10.130,local_lock=none,addr=192.168.10.2
5)

[root@client ~]# vim /etc/fstab


192.168.10.25:/nfsshare /nfstest nfs defaults,_netdev 00
[root@client ~]# mount –a
Note: nfs option with no_root_squash ==> Map the real uid:gid for superuser and
standard user accounts, used in diskless clients.
Note: nfs option with root_squash ==> Map the share to nobody:nobody for superuser,
but for the standard user map the real uid:gid.
Note: nfs option with all_squash ==> Map the share to nobody:nobody for superuser and
standard users, used in public share.
To reload NFS Server share configuration we use exportfs –r command
Autofs Service:
Auto file system mounter: (autofs)
 It is client side feature.
 It reduce the network traffic over the network and server processing, if we has a
server and this server share directories over the network using either (NFS or
Samba).
 Users don’t need to have root privilege to run mount/umount commands.
 the automounter uses the same mount options used by the mount command,
including security options
 nfs is the default file system for automounter, but it can be used to automount a range
of different file systems
 Default time out 5 mins.
In case of one Directory:
1. Install the package (autofs)
2. Create Map (All direct maps entry use /- as the base directory, in this case, the
mapping file that contain the mount details is /etc/auto.direct)
3. Create the mount point
4. Create the mount point directory
5. Start and enable the service
6. Check with df -h before mounting and after mounting

[root@client ~]# yum install autofs


[root@client ~]# cd /etc/auto.master.d/
[root@client auto.master.d]#touch share.autofs
/- /etc/auto.share
[root@client auto.master.d]# touch /etc/auto.share
[root@client ~]# vim /etc/auto.share
/nfstest -rw,sync,fstype=nfs 192.168.10.25:/nfsshare
[root@client auto.master.d]# umount /nfstest
[root@client auto.master.d]# df –h
[root@client auto.master.d]# systemctl enable --now autofs
[root@client auto.master.d]# df –h ==> successful mapped

In case of multiple directories:


1. Install the package (autofs)
2. Create Map (All direct maps entry use /- as the base directory, in this case, the
mapping file that contain the mount details is /etc/auto.direct)
3. Create the mount point either multiple directories or use *and & option
4. Start and enable the service
5. Check with df -h before mounting and after mounting

[root@client ~]# yum install autofs


[root@client ~]# cd /etc/auto.master.d/
[root@client auto.master.d]#touch share.autofs
/nfstest /etc/auto.share
[root@client auto.master.d]#touch /etc/auto.share
* -rw,sync,fstype=nfs 192.168.100.25:/nfsshare/& or ali -
rw,sync,fstype=nfs 192.168.100.25:/nfsshare/ali
[root@client auto.master.d]# systemctl enable --now autofs
[root@client auto.master.d]# df –h ==> successful mapped
[root@client tarek]# mount | grep 192.168.10.130

Notes:
 In indirect we must create subdirectories on the server

You might also like