A very condensed post about setting up an example NFS server 192.0.2.1 and client 192.0.2.16. All actions as root.
Configure the server 192.0.2.1
sudo su
apt update
apt install nfs-kernel-server
systemctl start nfs-kernel-server.service
mkdir -p /data/acme
nano /etc/exports
And add this to file exports
:
/data/acme *(rw,sync,no_subtree_check)
Next:
exportfs -a
ufw status
ufw allow from 192.0.2.16 to any port nfs
“ufw status numbered” list rules. To remove a rule – say number 5 – do “ufw delete 5”.
Configure the client 192.0.2.16
sudo su
apt update
apt install nfs-common
mkdir -p /data/nfs/acme
nano /etc/fstab
In fstab
, add:
192.0.2.1:/data/acme /data/nfs/acme nfs defaults 0 0
Additional information
NFS can be hard to configure. Links below and specific searches can help.
One thing is important, communication between guest and host is based on user and group information and it is important to understand that uid and gid play a role here, they should be the same on host and guest. You have to retrieve them from a guest station (“id -u UserName” and “id -g UserName” returning for example 1003 and 1005) and a line in /etc/exports on the server can look like:
/data/acme 192.0.2.16(rw,sync,all_squash,anonuid=1003,anongid=1005,no_subtree_check)
Leave a Reply