Welcome to the IPFire Wiki

This wiki is a community-maintained resource about everything there is to know about IPFire.

Please join in and help us improving it!

Differences in Revisions: NFS Addon

Older Revision
August 25 at 9:04 pm
»
NFS- Service Reload is not enough. After installing the nfs plugin a restart is necessary, because of missing (nfs) services.
#NFS Addon
 
NFS is a [Network File System](https://en.wikipedia.org/wiki/Network_File_System_(protocol)), 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](http://nfs.sourceforge.net/).
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/ipfire/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](http://winscp.net/eng/docs/lang:de), directly over the IPFire [Console](/configuration/ipfire/pakfire/konsole) or via [Putty](http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html).
 
A finished export-file looks in approximately like this:
 
Filename = /etc/exports
```text
/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:
 
| item | description |
|---|---|
| /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 (PC´s in IP range from 192.168.x.x 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 | User and Group ID, who accessed to the NFS server. (99 = nobody, 0 = root) |
 
 
If the file is processed and stored, the NFS server must be reloaded now, this occurs with the command line:
If the file is processed and stored, the NFS server must be reloaded now. To do so and start the missing services, the following command line is vital:
 
`/etc/init.d/nfs-server reload`
`/etc/init.d/nfs-server restart`
 
If not everything are returned here with ** <color green>OK</color> **, 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:
 
filename = /etc/fstab
```text
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!
 
<WRAP round center 80% info>
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 **<color blue>blue</color>** network segment, a record must take place in the file*hosts.allow*.
The record:
 
/etc/hosts.allow
 
 
…. will need these lines created (add them)
 
```text
sshd : ALL
ALL : localhost
ALL : 192.168.0.0/255.255.255.0
```