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

Chapter11 Accessing Network Storage With Network File System (NFS)

The document discusses Network File System (NFS) which allows mounting network shared directories across Linux/Unix systems. It describes NFS versions, configuration of NFS server and clients, options for export, mounting NFS shares permanently or temporarily, and use of autofs for automatic mounting of NFS shares.

Uploaded by

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

Chapter11 Accessing Network Storage With Network File System (NFS)

The document discusses Network File System (NFS) which allows mounting network shared directories across Linux/Unix systems. It describes NFS versions, configuration of NFS server and clients, options for export, mounting NFS shares permanently or temporarily, and use of autofs for automatic mounting of NFS shares.

Uploaded by

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

Network File System:

-don't have standard port(problem in nfs)


- RHEL7 supports NFSv4 by default, and falls back automatically to NFSv3 and NFSv2
if that is not available.
- NFSv4 uses the TCP protocol to communicate with the server, while older versions
of NFS may use either TCP or UDP.
- NFS requires rpcbind, which dynamically assigns ports for RPC services and can
cause problems for configuring firewall rules. To allow clients to access NFS
shares behind a firewall, edit the /etc/sysconfig/nfs configuration file to control
which ports the required RPC services run on.
( Allow TCP and UDP port 2049 for NFS and allow TCP and UDP port 111
(rpcbind/sunrpc)).
- NFS doesn't support user authentication.
- All users can see the exported directories even if they don't have access.

[root@master ~]# yum install -y nfs-utils


[root@master ~]# systemctl start nfs-server (nfs in previous
distributions)
[root@master ~]# systemctl enable nfs-server
[root@master ~]# systemctl stop firewalld
[root@master ~]# vim /etc/exports
/data 192.168.1.0/24(ro)
/data 192.168.1.101(rw)
/data ecst.com(rw)
/data pc.ecst.com(ro)
/data 192.168.1.0/24(ro) 192.168.2.0/24(rw)

- Options can be ro, rw, sync, root_squash and no_root_squash

[root@master ~]# systemctl restart nfs-server (terminates all open sessions)


[root@master ~]# exportfs -r (re-read the config file
without termination of open
sessions)
[root@master ~]# exportfs -f (force re-read the config
file)

[root@client ~]# showmount -e 192.168.1.100


[root@client ~]# mount 192.168.1.100:/data /root/data (temporary)
[root@client ~]# df -hT (nfs4)
[root@client ~]# vim /etc/fstab (for permanent mounting)
192.168.1.100:/data /root/data nfs _netdev 0 0
or)
192.168.1.100:/data /root/data nfs defaults,timeout=3 0 0
==========================================================================
The root squash:

[root@master ~]# vim /etc/passwd


nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin

[root@master ~]# vim /etc/exports


/data 192.168.1.0/24(rw,no_root_squash)

[root@client data]# chmod a=rw file1 (will be permitted)


==========================================================================
To give write permissoions to the users:
[root@master ~]# chmod o+w /data/
[root@client ~]# cd data/
[root@client data]# touch file5
==========================================================================
Autofs:
The automounter is a service (autofs} that can automatically mount NFS shares "on
demand," and will automatically unmount NFS shares when they are no longer being
used.

[root@client ~]# yum install -y autofs


[root@client ~]# systemctl start autofs
[root@client ~]# systemctl enable autofs
[root@client ~]# vim /etc/auto.master
/root/data /etc/auto.data

[root@client ~]# vim /etc/auto.data


pub -rw 192.168.1.100:/data
where pub is the target directory we want to access.

[root@client ~]# systemctl restart autofs


[root@client ~]# cd data/pub
[root@client ~]# df -hT
192.168.1.100:/data nfs4 10G 32M 10G 1% /root/data/pub

[root@client ~]# vim /etc/autofs.conf (to change configuration of autofs )


timeout = 300 (the idle user will be disconnected after 5 min
by default)
==========================================================================

Best wishes:
Abeer :)

You might also like