wiki.ipfire.org

The community-maintained documentation platform of IPFire

User Tools

Site Tools


addons:nfs:start

NFS Addon

NFS is a Network File System, it was developed by SUN Microsystems and enable the access to files in a network infrastructure. You can get a deeper knowledge about NFS in here. In order to operate a NFS server on the IPFire, the nfs package needs to be installed.

Installation

NFS can be installed as an IPFire addon over the console with:

pakfire install nfs

or over the IPFire web interface via Pakfire

Configuration

After the successful installation of both Addons they are to be seen in the right selection field on the Pakfire page in the Webinterface.

If you want to start now the NFS-server, it is necessary to edit the file “/etc/exports”. You can manage this with WinSCP, directly over the IPFire Console or via Putty.

A finished export-file looks in approximately like this:

File: /etc/exports
  /mnt/harddisk/Daten 192.168.0.0/24(rw,async,subtree_check,
  no_root_squash,anonuid=99,anongid=99)

In the example the following options were set:

/mnt/harddisk/Data The directory on the IPFire where the data to be stored
192.168.0.0/24 The IP or the network, which may access the NFS server (all PC´s with the IP range from 192.168.x.x are permitted
rw Enable read and write access
async Allow the server to cache the data and to write it only if the opportunity is in addition
subtree_check This option proofs that the data will be written in the correct subdirectory
no_root_squash The anonymous user/GruppenID
anonuid=99,anongid=99 Here are the user and the group ID, who have accessed to the NFS server. (99 is nobody, 0 is root)

Note:More information about the NFS options can be found in here.

If the file is processed and stored, the NFS server must be reloaded now, this occurs with the command line:

/etc/init.d/nfs-server reload

If not everything are returned here with OK , some options are falsely set or not available .

Client-Configuration

The following steps on Client side leads now to the target:

  • create a file and modify owner/group
  • indicate where the server is

Under Linux the slogan takes affect “all is a file”. These following the released folder on the server is also a file or a directory. We create this new file under the directory “/media”. Thus a file on the Client exists, which refers in reality to the server (and nobody will notice it).

sudo mkdir /media/server

creates the file. In place of “server” you take any name which you prefer. This file belonged however to the user root and as normal user you do not have access on it. To change this two command lines are necessary:

sudo chmod user /media/server
sudo chgrp user /media/server

Now the file belongs to the user (your user name) and the user can access it. However it is missing still another little thing, cause the reference, that this file is to refer its contents from the server.

Where is the server?

We divide the client now where the server is. You need to enter the following line into the file “/etc/fstab” additionally:

file: /etc/fstab
 192.168.0.1:/home/user/shared /media/server nfs rw,rsize=8192,wsize=8192 0 0

The file “/etc/fstab” is a list of all volumes which according to standard accesses. Here you should find the record from all your volumes.

We go now through, what you even entered

  • The IP-address from the beginning (192.168.0.1) are the server address. Then a colon follows as separation between IP-address and the file, which on the server is approved, namely “/home/user/shared”. Thus we have said where their Client have to quest to, if he wants to store the data.
  • Afterwards follows “/media/server”. That is the file on the client which points to the server. The trick is: You store something into the file “/media/server” and in reality the contents of the file are on the server !
  • In the following we have the specification which file system it is, nfs is the “network file system”. The specification “rsize” and “wsize” are set to 8192. These create a buffer of 8192 kilobytes with which reading and writing go faster. The first zero are a information for the safeguarding program dump whether this file should be secured or not. The last zero are a character for the fact that this file is not a root file system or a file system on a local fixed disk. It is a “other file system”, therefore a 0.

Last step - mounting the directory

sudo mount -a

This mounts the remote shared resource into the local file system on “/media/server”. The storage space on the remote server should be available to you and you should be able to place files into the folder as well. Have fun!

If IPFire should act as a client, the record in “/etc/fstab” is not enough to mount the network drive automatically during the boot process. A workaround is to insert the line below into the file “/etc/sysconfig/rc.local”

mount -a -t nfs

Activate NFS over W-LAN

To release portmap on the blue network segment, a record must take place in the file hosts.allow. The record:

/etc/hosts.allow

…. will need these lines created (add them)

sshd : ALL
ALL  : localhost
ALL  : 192.168.0.0/255.255.255.0
addons/nfs/start.txt · Last modified: 2018/09/22 03:17 by Jon