The TCP/IP Guide - Version 3.0 (Contents) ` 1092 _ © 2001-2005 Charles M. Kozierok. All Rights Reserved.
standardized software modules, sometimes called procedures. To perform an action, a
piece of software calls the procedure; the procedure temporarily takes over for the main
program and performs a task such as reading or writing data. The procedure then returns
control of the program back to the software that called it, and optionally, returns data as
well.
Since the key concept of NFS was to make remote file access look like local file access, it
was designed around the use of a network-based version of the procedure calling method
just described. A software application that wants to do something with a file still makes a
procedure call, but it makes the call to a procedure on a different computer instead of the
local one. A special set of routines is used to handle the transmission of the call across the
network, in a way largely invisible to software performing the call.
This functionality could have been implemented directly in NFS, but instead Sun created a
separate session-layer protocol component called the Remote Procedure Call (RPC) speci-
fication, which defines how this works. RPC was originally created as a subcomponent of
NFS, but is generic enough and useful enough that it has been used for other client/server
applications in TCP/IP. For this reason, it is really considered in many respects a distinct
protocol.
Because RPC is the actual process of communicating in NFS, NFS itself is different from
many other TCP/IP protocols. Its operation can't be described in terms of specific message
exchanges and state diagrams the way a protocol like HTTP or DHCP or even TCP can,
because RPC does all of that. NFS is in fact defined in terms of a set of RPC server proce-
dures and operations that an NFS server makes available to NFS clients. These
procedures and operations each allow a particular type of action to be taken on a file, such
as reading from it, writing to it or deleting it.
RPC Operation and Transport Protocol Usage
When a client wants to perform some type of action on a file on a particular machine, it uses
RPC to make a call to the NFS server on that machine. The server accepts the request and
performs the action required, then returns a result code and possibly data back to the client,
depending on the request. The result code indicates if the action was successful. If it was,
the client can assume that whatever it asked to be done was completed. For example, in
the case of writing data, the client can assume the data has been successfully written to
long-term storage.
NFS can operate over any transport mechanism that has a valid RPC implementation at the
session layer. Of course in TCP/IP we have two transport protocols, UDP and TCP
. It's
interesting to see that NFS has seen an evolution of sorts in its use of transport protocol.
The NFSv2 standard says that it operates “normally” using UDP, and this is still a common
way that NFS information is carried. NFSv3 says that either UDP or TCP may be used, but
NFSv4 specifies TCP to carry data. The nominal registered port number for use by NFS is
2049, but in fact other port numbers are sometimes used for NFS, through the use of RPC's
“port mapper” capability.