Save the file and export the shares: sudo exportfs -ar For more information about all the available options type man exports in your terminal. The sync option tells NFS to write changes to the disk before replying. The read access is allowed to the whole 192.168.33.0/24 range, and both read and write access only to the 192.168.33.3 IP address. The second line shows how to specify multiple export rules for one filesystem. The crossmnt option is required to share directories that are sub-directories of an exported directory. Access to this NFS volume is allowed only to the clients from the 192.168.33.0/24 subnet. To make the bind mounts permanent across reboots, open the /etc/fstab file: sudo nano /etc/fstab To better explain how the NFS mounts can be configured, we’re going to share two directories ( /var/First create the root directory and the share mount points: sudo mkdir -p /srv/nfs4/backups sudo mkdir -p /srv/nfs4/wwwīind mount the directories to the share mount points: sudo mount -bind /opt/backups /srv/nfs4/backups sudo mount -bind /var/www /srv/nfs4/www In this example, we’ll set the /srv/nfs4 directory as NFS root. You can link the share mount point to the directories you want to export using bind mounts. The NFSv4 server uses a global root directory, and the exported directories are relative to this directory. The default settings are sufficient for most situations. NFS server configuration is defined in /etc/default/nfs-kernel-server and /etc/default/nfs-common files. NFSv2 is pretty old now, and there is no reason to enable it. You can verify that by running the following cat command On Ubuntu 20.04, NFS version 2 is disabled. Once the installation is completed, the NFS services will start automatically. To install the package, run: sudo apt update sudo apt install nfs-kernel-server The NFS server package provides user-space support needed to run the NFS kernel server. We’ll install the necessary packages, create and export the NFS directories, and configure the firewall. The first step is to set up the NFS server. The machines in this example have the following IPs: You can use public IP addresses and configure the server firewall to allow traffic on port 2049 only from trusted sources. The server and the clients should be able to communicate with each other over a private network. We’ll use two machines, one running Ubuntu 20.04, which will act as an NFS server, and another one running any other Linux distribution on which we will mount the share. We’ll also show you how to mount an NFS file system on the client machine. This article explains how to set up an NFSv4 Server on Ubuntu 20.04. Access to the server is restricted by the client’s IP addresses or hostnames. With NFS, you can mount remote directories on your system and work with the files on the remote machine as if they were local files.īy default, the NFS protocol is not encrypted and does not provide user authentication. NFS or Network File System is a distributed file system protocol that allows you to share directories over a network.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |