Network File Services  «Prev  Next»

Lesson 3 Remote procedure calls
Objective Explain the relationship between remote procedure calls and NFS.

Remote Procedure Calls

Remote procedure calls (RPCs) enable NFS to transparently provide remote files to local computers. An RPC allows a client program to request a service from another computer without needing to know network details. Consequently, an RPC frees NFS from network-specific implementations and allows NFS to focus on providing network file access semantics. File access semantics: When a file is opened, closed, read from, or written to, certain guidelines, or semantics must be in place. These semantics are "right-of-way" indicators, describing what happens when programs make conflicting requests. For example, a read/write semantic would define who has the right-of-way when one program reads from a file that is being written to by another program.
The following SlideShow illustrates how RPC enables an NFS client to mount and access remote filesystems.

Relationship between RPC and NFS

Question: What is the relationship between Remote Procedure Calls and Network File Systems? Remote Procedure Calls (RPC) and Network File Systems (NFS) are two related technologies that are often used together to enable remote access to files and services over a network. NFS is a file system protocol that allows files and directories to be shared over a network, and enables remote clients to access files and directories on a server as if they were local. NFS provides a set of operations that clients can use to access files and directories, such as read, write, and create. RPC is a protocol that allows applications to make remote procedure calls to a server over a network, and enables remote clients to access services and resources on a server as if they were local. RPC provides a mechanism for marshalling and unmarshalling data and arguments across a network, and allows clients to invoke procedures on a server and receive responses. The relationship between RPC and NFS is that NFS uses RPC as its underlying transport protocol to communicate between clients and servers. When a client sends an NFS request to a server, the request is encapsulated in an RPC message and sent over the network to the server. The server then processes the request, generates a response, and sends the response back to the client in another RPC message.
Overall, the combination of NFS and RPC allows remote clients to access files and directories on a server over a network, and provides a transparent and efficient way to share resources and collaborate across multiple systems and users.

The Remote Procedure Call Process

1) First, mount asks the local portmapper program, portmap, to establish a connection to the NFS mount service on the remote computer
1) First, mount asks the local portmapper program, portmap, to establish a connection to the NFS mount service on the remote computer

2) portmap takes care of all the networking details and establishes a connection to the remote server
2) portmap takes care of all the networking details and establishes a connection to the remote server

3) The NFS server's portmapper program (also referred to simply as portmap) receives the mount request and forwards it to the NFS mounter, rpc.mountd
3) The NFS server's portmapper program (also referred to simply as portmap) receives the mount request and forwards it to the NFS mounter, rpc.mountd

4) rpc.mountd checks the mount request against the list of exported filesystems and checks the client's access privileges to the filesystem
4) rpc.mountd checks the mount request against the list of exported filesystems and checks the client's access privileges to the filesystem

5) rpc.mountd opens the filesystem and returns an access handle to the client
5) rpc.mountd opens the filesystem and returns an access handle to the client

6) When the client accesses a file on the NFS server, it sends the access request and the handle through portmap to the server
6) When the client accesses a file on the NFS server, it sends the access request and the handle through portmap to the server

7) The server's portmap recognizes that this is not a mount request but a general NFS request, so it forwards the requests to rpc.nfsd
7) The server's portmap recognizes that this is not a mount request but a general NFS request, so it forwards the requests to rpc.nfsd

8) rpc.nfsd services the request and returns a result back to the client . All other general NFS requests happen like this.
8) rpc.nfsd services the request and returns a result back to the client . All other general NFS requests happen like this.

Network File System

A (NFS) Network File System allows remote hosts to mount file systems over a network and interact with those file systems as though they are mounted locally. This enables system administrators to consolidate resources onto centralized servers on the network.
This module focuses on fundamental NFS concepts and supplemental information. For specific instructions regarding the configuration and operation of NFS server and client software, refer to the module titled (NFS) Network File System Redhatlinuxsysadmin. Currently, there are two versions of NFS. NFS version 2 is older and is widely supported. (NFSv3) NFS version 3 has more features, including variable size file handling and better error reporting, but is not fully compatible with NFSv2 clients. Red Hat Enterprise Linux serves both
  1. NFSv2 and
  2. NFSv3
clients, and when mounting a file system via NFS, Red Hat Enterprise Linux uses NFSv3 by default, if server the supports it.
NFSv2 uses the (UDP) User Datagram Protocol to provide a stateless network connection between the client and server. NFSv3 can use either UDP or (TCP) Transmission Control Protocol running over an IP network.
The stateless UDP connection under normal conditions minimizes network traffic, as the NFS server sends the client a cookie after the client is authorized to access the shared volume. This cookie is a random value stored on the server's side and is passed along with RPC requests from the client. The NFS server can be restarted without affecting the clients and the cookie remains intact. However, because UDP is stateless, if the server goes down unexpectedly, UDP clients continue to saturate the network with requests for the server. For this reason, TCP is the preferred protocol when connecting to an NFSv3 server.
The NFS daemon (rpc.nfsd) and RPC mounter (rpc.mountd) do not need to run on the NFS client. Save some system memory and turn them off.

Listing registered RPC Programs

When an RPC program such as rpc.nfsd or rpc.mountd starts, it must register itself with the portmapper program, portmap. The rpcinfo command, with the -p parameter, lists all registered RPC programs.
For example, to list all registered programs on your local system, use rpcinfo -p. To list all registered programs on a remote server, supply the hostname: rpcinfo -p server.mycompany.com.

In the next lesson, you will learn how to configure a NFS server.

Nfs Rpc - Quiz


Before moving on to the next lesson, click the Quiz link below to answer some questions about NFS and RPC.
NFS RPC - Quiz

SEMrush Software 3 SEMrush Banner 3