The port mapper (rpc.portmap or just portmap) is a service that runs on nodes on the Internet for the purpose of mapping an ONC RPC program number to the network address of the server that listens for the program number.
Portmap is server software running under Unix-like systems that converts RPC program numbers into DARPA protocol port numbers. Its design objective was to minimize the number of ports in use, but this never happened as it never had wide adoption. It must be running in order to make RPC calls.
When an RPC server is started, it will tell portmap what port number it is listening to, and what RPC program numbers it is prepared to serve. When a client wishes to make an RPC call to a given program number, it will first contact portmap on the server machine to determine the port number where RPC packets should be sent.
Portmap must be started before any RPC servers are invoked.
This shows the different programs and their versions, and which ports they use. For example, it shows that NFS is running, both version 2 and 3, and can be reached at TCP port 2049 or UDP port 2049, depending on what transport protocol the client wants to use.
$ rpcinfo -p program vers proto port 100000 2 tcp 111 portmapper 100000 2 udp 111 portmapper 100003 2 udp 2049 nfs 100003 3 udp 2049 nfs 100003 4 udp 2049 nfs 100003 2 tcp 2049 nfs 100003 3 tcp 2049 nfs 100003 4 tcp 2049 nfs 100024 1 udp 32770 status 100021 1 udp 32770 nlockmgr 100021 3 udp 32770 nlockmgr 100021 4 udp 32770 nlockmgr 100024 1 tcp 32769 status 100021 1 tcp 32769 nlockmgr 100021 3 tcp 32769 nlockmgr 100021 4 tcp 32769 nlockmgr 100005 1 udp 644 mountd 100005 1 tcp 645 mountd 100005 2 udp 644 mountd 100005 2 tcp 645 mountd 100005 3 udp 644 mountd 100005 3 tcp 645 mountd
On UNIX and Linux systems see the /etc/services file for the list of port numbers and their associated protocol names or services (well known port numbers are assigned within the range of 0 to 1023 via IANA). See: List of TCP and UDP port numbers.