[EdCert previous] [EdCert next] [EdCert top]

Remote Procedure Call and the portmapper daemon

Sun Microsystems has developed a mechanism for client-server applications called RPC, Remote Procedure Call, which is in the public domain and used by most flavors of Unix. Applications such as NFS, the Network File System, and NIS, the Network Information System are based on RPC.

An RPC server provides a group of procedures which a client can call by sending a request to the server. The server then invokes the procedure on behalf of the client, returning a value as necessary.

The collection of procedures that an RPC server provides is called a program and is identified by a program number. The file /etc/rpc maps service names to their program numbers. Like the /etc/services file, everything that you are likely to need will be in the file as it is distributed. You will only need to edit this file if you bring up a new RPC server providing a new set of procedures. The following is an excerpt from an example /etc/rpc.

# RPC program number data base
# $Revision: 1.5 $	 (from 88/08/01 4.0 RPCSRC)
#
portmapper      100000  portmap sunrpc
rstatd          100001  rstat rup perfmeter
rusersd         100002  rusers
nfs             100003  nfsprog
ypserv          100004  ypprog
mountd          100005  mount showmount
ypbind          100007
walld           100008  rwall shutdown
yppasswdd       100009  yppasswd
etherstatd      100010  etherstat
rquotad         100011  rquotaprog quota rquota

A problem is introduced with this mechanism. RPC servers do not use reserved ports (as opposed to those services listed in the /etc/services file); when they start they just use any port that they can find available. When a client program wants to request a particular RPC service, it has no way of knowing on which port the program number it wants to access is provided. It needs a way to find out.

The portmapper daemon solves this problem. It maps RPC program numbers to the TCP/IP ports on which their servers are listening. When an RPC server starts, it picks an available port, and then registers that port and what RPC program numbers it will serve with the portmapper daemon. When a client program needs to access a service, it first queries the portmapper on the RPC server's host which reports the TCP and UDP port on which the server is listening, and then it contacts that port to request its service.

When the portmapper daemon dies it loses all of its port information, and all of the services that rely on the portmapper must be restarted. Unfortunately, since many RPC servers are started via inetd, it is also affected. When restarting services, the portmapper daemon must be started before inetd so that inetd can properly handle its RPC services. To make a long story short, if the portmapper daemon dies, you typically need to reboot.


Terms used: RPC, public domain, NFS, NIS, port, portmapper, inetd, reboot.




[EdCert previous] [EdCert next] [EdCert top]