Services for UNIX |
The Remote Procedure Call (RPC) protocol enables a computer to make a call that is executed on another computer on the network. The Remote Procedure Call protocol is based on a client/server model. The client makes a procedure call that appears to be local but is actually run on a remote computer. During this process, the procedure call arguments are bundled and passed through the network to the server. The arguments are unpacked and run on the server. The result is bundled and passed back to the client, where it is converted to a return value for the client's procedure call.
RPC can use either UDP or TCP; since RPC calls are short, UDP is preferred. Because of this, an RPC call must contain enough information to be run independently, since UDP does not deliver packets in order. In addition, the client can specify a time limit, after which, if the call is not completed successfully, it can be resent or sent to another server.
Four values define an RPC service: the program number, the version number of the RPC protocol, the procedure number (usually assigned sequentially), and whether UDP or TCP is the transport protocol. Each RPC service is assigned a program number.
RPC provides a collection of procedures called programs. Each program is identified by a program number. For example, NFS is a program with a program number of 100003.
When an RPC service starts under UNIX, it registers its service with the portmapper daemon. It registers the RPC program number and version and provides a TCP or UDP port number to which it listens for incoming requests. The portmapper itself is an RPC service that listens on TCP and UDP port 111.
The rpcinfo command is used to show all the RPC programs that are registered on a specified computer. Any RPC programs and their IP port numbers are listed in files by using either portmapper or rpcbind.
Table 11.2 lists some of the options you can use with rpcinfo.
Table 11.2 Command Line Options for rpcinfo
Option | Description |
---|---|
-p [host] | Lists all registered RPC programs on the specified host. |
-u <host program> [ver] <received> | Sends the null command to the target host and RPC program using UDP and reports whether a response was received. |
-t <host program> [ver] <received> | Sends the null command to the target host and RPC program using TCP and reports whether a response was received. |
-b <program version> | Makes an RPC broadcast for a specific program and version using UDP and lists all responding hosts. |
Rpcinfo is useful for diagnosing RPC problems, such as whether or not a server is active, problems with the portmapper daemon, or broadcast-related issues.
Table 11.3 lists the RPC calls that a NFS client can make to a server.
Table 11.3 NFS Version 2 RPC Calls
RPC Call Name | Description |
---|---|
create | Create file |
getattr | Get file attributes |
link | Create link to file |
lookup | Look up file name |
mkdir | Create directory |
read | Read from file |
readdir | Read from directory |
readlink | Read from symbolic link |
remove | Remove file |
rename | Rename file |
rmdir | Remove directory |
setattr | Set file attributes |
statfs | Get file system attributes |
symlink | Create symbolic link |
write | Write to file |
Table 11.4 NFS Version 3 RPC Calls
RPC Call Name | Description |
---|---|
access | Check user access permission |
create | Create file |
commit | Commit cached data to stable storage |
fsstat | Get file system attributes |
fsinfo | Get file system information |
getattr | Get file attributes |
link | Create link to file |
lookup | Look up file name |
mkdir | Create directory |
mknod | Create special device node |
pathconf | Retrieve POSIX information |
read | Read from file |
readdir | Read from directory |
readdirplus | Extended read from directory |
readlink | Read from symbolic link |
remove | Remove file |
rename | Rename file |
rmdir | Remove directory |
setattr | Set file attributes |
symlink | Create symbolic link |
write | Write to file |