Sharing disks with NFS network
________________________________________
Follow us on Facebook
Follow us on Google+
________________________________________
Introduction
NFS (Network File System) is a protocol used to mount network disks. This protocol is based on the client / server principle has been developed by Sun Microsystems in 1984. It can be used to exchange data between Linux, Mac or Windows. One of its advantages is that it manages file permissions.
Installing NFS
On Fedora, normally the tools for setting up a network via nfs are installed. You can check it with the command:
$ Rpm-qi nfs-utils
If you get back a message like: "The nfs-utils is not installed", you can install nfs-utils with the command:
# Yum install nfs-utils
Configuring NFS
Before starting the configuration, you must know the IP addresses of your client and server machines. You can get the address of each machine using the command:
$ / Sbin / ifconfig
Server-side
You must edit the file / etc / exports and add a line like:
/ path / to / shared @ _ip_client (rw) @ _ip_client2 (rw)
For example, if you want to share your / home / user and the client has the address 192.168.0.23, you would add the line: / home / user 192.168.0.23 (rw) Then it'll just restart the NFS server with the command:
# Service nfs start
Since Fedora 16, systemd uses NFS, it should run it with the command:
# Systemctl start nfs-server.service
If you want the service to be active in the launch of Fedora:
Client-side configuration
First you need to create a folder that will contain the shared / mnt or / media for example. Then you can mount the file directly with the command:
# Mount-t nfs @ _ip_serveur :/ path / to / share / mnt / share
It is also possible to mount at boot time, for this simply edit the file / etc / fstab and add a line like:
@ _ip_serveur :/ path / to / share / mnt / share nfs auto, user, rw 0 0
Once this change is made, you can mount all partitions in fstab by typing the command:
# Mount-a
You can use showmount to list information for mounting an NFS server:
$ Showmount-e <IP_du_serveur_NFS>
Some security
Configuring the firewall
Default portmap ports dynamically defined using NFS and transmits them to client port 2049, which makes the configuration of firewall. For simplicity, it is preferable to set the ports to allow our firewall enabled. You can either use the graphical tool, system-config-nfs or edit the file / etc / sysconfig / nfs manually so that it has the following parameters:
LOCKD_TCPPORT = 32803
LOCKD_UDPPORT = 32769
MOUNTD_PORT = 892
STATD_PORT = 662
Then, modify the configuration by fire so that your open its ports
# System-config-firewall
Ports are open:
2049 (nfs) tcp / upd
111 tcp / upd
32803 tcp / udp
32769 tcp / udp
892 tcp / udp
662 tcp / udp
By default, only the ports 2049, 111 and MOUNTD_PORT are used. The other match Diversent NFS server option.
Finally, you must restart the NFS service changes to take into account:
# / Etc / init.d / nfs restart
If you want to start the NFS server startup, use:
# Chkconfig nfs on
# Chkconfig rpcbind on
(adjust if you enable nfslock etc.).