Introduction Network File System (NFS) is a distributed file system protocol originally developed by Sun Microsystems (Sun) in 1984. It allows a user on a client computer to access files over a computer network much like local storage is accessed. NFS, like many other protocols, builds on the Open Network Computing Remote Procedure Call (ONC RPC) system. The NFS is an open standard defined in a Request for Comments (RFC), allowing anyone to implement the protocol. NFS allows a system to share directories and files with others over a network. By using NFS, users and programs can access files on remote systems almost as if they were local files.
The server implements NFS daemon processes, running by default as nfsd , to make its data generically available to clients. The server administrator determines what to make available, exporting the names and parameters of directories, typically using the / etc /exports configuration file and the exportfs command. The server security-administration ensures that it can recognize and approve validated clients. The server network configuration ensures that appropriate clients can negotiate with it through any firewall system. The client machine requests access to exported data, typically by issuing a mount command. (The client asks the server ( rpcbind ) which port the NFS server is using, the client connects to the NFS server ( nfsd ), nfsd passes the request to mountd ) If all goes well, users on the client machine can then view and interact with mounted filesystems on the server within the parameters permitted. Typical Implementation
NFS Architecture
NFS Versions Version 2 Version 2 of the protocol originally operated only over User Datagram Protocol (UDP). Its designers meant to keep the server side stateless, with locking (for example) implemented outside of the core protocol. Version 3 Support for 64-bit file sizes and offsets, to handle files larger than 2 Gigabytes Support for asynchronous writes on the server, to improve write performance. Additional file attributes in many replies, to avoid the need to re-fetch them.
NFS Versions Version 4 Version 4, influenced by Andrew File System (AFS) and Server Message Block (SMB, also termed CIFS), includes performance improvements, mandates strong security, and introduces a stateful protocol. NFS version 4 servers use a pseudo file system to provide clients with access to exported objects on the server. Prior to NFS version 4 a pseudo file system did not exist. Aims to provide protocol support to take advantage of clustered server deployments including the ability to provide scalable parallel access to files distributed among multiple servers. Only one UDP or TCP port, 2049, is used to run the service, which simplifies using the protocol across firewalls.
Installation & Configuration sudo apt install nfs -kernel-server You can configure the directories to be exported by adding them to the / etc /exports file. For example: /ubuntu *( ro,sync,no_root_squash ) /home *( rw,sync,no_root_squash ) You can replace * with one of the hostname formats. Make the hostname declaration as specific as possible so unwanted systems cannot access the NFS mount. To start the NFS server, you can run the following command at a terminal prompt: sudo systemctl start nfs -kernel- server.service
Advantages NFS is a low-cost solution for network file sharing that is easy to setup as it uses the existing IP infrastructure. A significant advantage of NFS is that it allows for central management, decreasing the need for added software and disk space on individual user systems. NFS is user-friendly, allowing users to access files on remote hosts in the same way they access local files. This reduces the need for removable media storage devices and increases security as fewer CDs, DVDs, Blu-Ray disks, diskettes and USB drives are in circulation.
Disadvantages NFS is based on RPC, remote procedure calls, it is inherently insecure and should only be used on a trusted network behind a firewall. You will not want a root account to access an exported file system due to the potential damage Therefore, the system by default activates “root squashing” to prevent a root account accessing an exported file system. The “root squashing” can be changed, however. It may become evident is the performance limitations of the network. NFS will slow down during heavy network traffic