NFS - Network File System ============================== .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **What is NFS?** NFS (Network File System) is a distributed file system protocol originally developed by Sun Microsystems in 1984. It allows a user on a client computer to access files over a network in the same way they would access local storage. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Why is NFS useful?** * **Remote File Access** – Enables users to access files stored on remote servers as if they were local. * **Centralized Storage** – Simplifies data management by storing files in one place and sharing them across multiple clients. * **Platform Independence** – Works across different operating systems (e.g., Linux, UNIX, macOS). * **Scalability** – Suitable for small networks to large enterprise environments. * **Transparent Integration** – Seamlessly integrates with existing file systems and user workflows. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **How it works?** * **Server Setup** – The NFS server exports directories to be shared over the network. * **Client Mounting** – The client mounts the exported directory using the NFS protocol. * **File Access** – The client reads/writes files as if they were on a local disk. * **RPC Communication** – NFS uses Remote Procedure Calls (RPC) to communicate between client and server. * **Caching & Locking** – Clients may cache data and use file locking mechanisms to manage concurrent access. * **Security & Permissions** – Access is controlled using export rules, user IDs, and optionally Kerberos authentication. * **Unmounting** – The client can unmount the NFS share when access is no longer needed. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Where is NFS used?** * **Enterprise Networks** – For centralized file storage and sharing across departments. * **Data Centers** – To provide shared access to configuration files, logs, and backups. * **High-Performance Computing (HPC)** – For sharing large datasets across compute nodes. * **Virtualization Environments** – Used by hypervisors to access VM images and ISO files. * **Educational Institutions** – For shared access to course materials and user directories. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Which OSI Layer does this protocol belong to?** * **Data Representation** – NFS ensures consistent file formats and encoding across different systems. * **Data Translation** – Converts data between different machine architectures (e.g., big-endian vs little-endian). * **Syntax Negotiation** – Handles file naming conventions and data structure alignment across platforms. * Therefore, NFS operates mainly at the **Presentation Layer (Layer 6)** of the OSI model. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Is NFS Windows-specific?** * No, NFS is not Windows-specific. * NFS was originally developed by Sun Microsystems for Unix systems. * However, Windows Services for UNIX and some editions of Windows Server provide support for NFS. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Is NFS Linux-specific?** * No, NFS is not Linux-specific. * It is widely used on Linux and other Unix-like systems, but also supported on BSD, macOS, and some Windows versions. * Linux has robust support for NFS both as a client and a server. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Which Transport Protocol is used by NFS?** * NFS can use both **UDP** and **TCP**. * Modern versions (NFSv3 and later) typically use **TCP** for better reliability, especially over wide-area networks. * It uses **RPC (Remote Procedure Call)** as the underlying mechanism. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Which Port is used by NFS?** * NFS uses **port 2049** by default. * It also relies on the **portmapper** (on **port 111**) to help clients find NFS services, especially in older versions or when using RPC-based services. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow **Is NFS using Client-server model?** * Yes, NFS uses the **client-server model**. * The NFS server exports file systems to clients, which then mount and interact with them as if they were local. .. panels:: :container: container pb-4 :column: col-lg-12 p-2 :card: shadow Topics in this section, * :ref:`Learnings in this section ` * :ref:`Terminology ` * :ref:`Version Info ` * :ref:`NFS Version&RFC Details ` * :ref:`NFS Basic Setup on Ubuntu using IPv4 ` * :ref:`NFS Basic Setup on Ubuntu using IPv6 ` * :ref:`NFS Protocol Packet Details ` * :ref:`NFS Usecases ` * :ref:`NFS Basic Features ` * :ref:`NFS Feature : File Sharing ` * :ref:`NFS Feature : Transparency ` * :ref:`NFS Feature : Stateless Protocol (v2&v3) ` * :ref:`NFS Feature : Stateful Protocol(v4) ` * :ref:`NFS Feature : Platform Independence ` * :ref:`NFS Feature : Mounting ` * :ref:`NFS Feature : Security ` * :ref:`NFS Feature : File Locking ` * :ref:`NFS Feature : Caching ` * :ref:`NFS Feature : Asynchronous Writes ` * :ref:`Reference links ` .. _NFS_step1: .. tab-set:: .. tab-item:: Learnings in this section * In this section, you are going to learn .. _NFS_step2: .. tab-set:: .. tab-item:: Terminology * Terminology .. _NFS_step3: .. tab-set:: .. tab-item:: Version Info * Version Info .. _NFS_step5: .. tab-set:: .. tab-item:: NFS Version&RFC Details .. csv-table:: :file: ./NFS/NFS_rfcdetails.csv :widths: 10,10,10,30 :header-rows: 1 .. _NFS_step19: .. tab-set:: .. tab-item:: NFS Basic Setup on Ubuntu using IPv4 * setup .. _NFS_step20: .. tab-set:: .. tab-item:: NFS Basic Setup on Ubuntu using IPv6 * setup .. _NFS_step6: .. tab-set:: .. tab-item:: NFS Protocol Packet Details **TCP Connection Establishment Packet** .. csv-table:: :file: ./NFS/NFS_packetdetails1.csv :widths: 10,20,30,10 :header-rows: 1 **RPC Call Packet** .. csv-table:: :file: ./NFS/NFS_packetdetails2.csv :widths: 10,20,30,10 :header-rows: 1 **NFS File Operation Packet** .. csv-table:: :file: ./NFS/NFS_packetdetails3.csv :widths: 10,20,30,10 :header-rows: 1 **RPC Reply Packet** .. csv-table:: :file: ./NFS/NFS_packetdetails4.csv :widths: 10,20,30,10 :header-rows: 1 **NFS Session Termination Packet** .. csv-table:: :file: ./NFS/NFS_packetdetails5.csv :widths: 10,20,30,10 :header-rows: 1 .. _NFS_step7: .. tab-set:: .. tab-item:: NFS Usecases .. csv-table:: :file: ./NFS/NFS_usecases.csv :widths: 10,20,30 :header-rows: 1 .. _NFS_step8: .. tab-set:: .. tab-item:: NFS Basic Features .. csv-table:: :file: ./NFS/NFS_basicfeatures.csv :widths: 10,10,30 :header-rows: 1 .. _NFS_step9: .. tab-set:: .. tab-item:: NFS Feature : File Sharing **File Sharing - Testcases** .. csv-table:: :file: ./NFS/NFS_feature1_File_Sharing_testcases.csv :widths: 10,10,30,20 :header-rows: 1 .. _NFS_step10: .. tab-set:: .. tab-item:: NFS Feature : Transparency **Transparency - Testcases** .. csv-table:: :file: ./NFS/NFS_feature2_Transparency_testcases.csv :widths: 10,10,30,20 :header-rows: 1 .. _NFS_step11: .. tab-set:: .. tab-item:: NFS Feature : Stateless Protocol(v2&v3) **Stateless Protocol(v2&v3) - Testcases** .. csv-table:: :file: ./NFS/NFS_feature3_Stateless_Protocol_v2andv3_testcases.csv :widths: 10,10,30,20 :header-rows: 1 .. _NFS_step12: .. tab-set:: .. tab-item:: NFS Feature : Stateful Protocol(v4) **Stateful Protocol(v4) - Testcases** .. csv-table:: :file: ./NFS/NFS_feature4_Stateful_Protocol_v4_testcases.csv :widths: 10,10,30,20 :header-rows: 1 .. _NFS_step13: .. tab-set:: .. tab-item:: NFS Feature : Platform Independence **Platform Independence - Testcases** .. csv-table:: :file: ./NFS/NFS_feature5_Platform_Independence_testcases.csv :widths: 10,10,30,20 :header-rows: 1 .. _NFS_step14: .. tab-set:: .. tab-item:: NFS Feature : Mounting **Mounting - Testcases** .. csv-table:: :file: ./NFS/NFS_feature6_Mounting_testcases.csv :widths: 10,10,30,20 :header-rows: 1 .. _NFS_step15: .. tab-set:: .. tab-item:: NFS Feature : Security **Security - Testcases** .. csv-table:: :file: ./NFS/NFS_feature7_Security_testcases.csv :widths: 10,10,30,20 :header-rows: 1 .. _NFS_step16: .. tab-set:: .. tab-item:: NFS Feature : File Locking **File Locking - Testcases** .. csv-table:: :file: ./NFS/NFS_feature8_File_Locking_testcases.csv :widths: 10,10,30,20 :header-rows: 1 .. _NFS_step17: .. tab-set:: .. tab-item:: NFS Feature : Caching **Caching - Testcases** .. csv-table:: :file: ./NFS/NFS_feature9_Caching_testcases.csv :widths: 10,10,30,20 :header-rows: 1 .. _NFS_step21: .. tab-set:: .. tab-item:: NFS Feature : Asynchronous Writes **Asynchronous Writes - Testcases** .. csv-table:: :file: ./NFS/NFS_feature10_Asynchronous_Writes_testcases.csv :widths: 10,10,30,20 :header-rows: 1 .. _NFS_step18: .. tab-set:: .. tab-item:: Reference links * Reference links