How Linux Uses rpcbind for Remote Procedure Calls

The rpcbind utility is a critical system service in Linux that manages Remote Procedure Call (RPC) connections by mapping RPC program numbers to universal network addresses. In traditional network architectures, services often bind to dynamic, ephemeral ports rather than standardized, static ones. This article explores the architecture of rpcbind, detailing how it facilitates service discovery, manages dynamic port allocation, coordinates communication between clients and servers, and maintains network security in modern Linux environments.

The Role of RPC and the Port Challenge

Remote Procedure Call (RPC) is a protocol that allows a program on one computer to execute code on a remote system as if it were a local function call. Linux relies heavily on RPC for distributed file sharing services, notably the Network File System (NFS) and Network Information Service (NIS).

Unlike standard internet services like HTTP (port 80) or SSH (port 22), most RPC-based services do not run on fixed, predictable port numbers. Instead, daemons like rpc.mountd, rpc.statd, and rpc.lockd request available dynamic ports from the Linux kernel upon startup. Because these ports change with every system reboot or service restart, clients cannot connect to these services directly without a central directory mechanism.

How rpcbind Solves the Mapping Problem

The rpcbind daemon—which replaces the legacy portmap service—acts as a central lookup coordinator for RPC communications. It listens on well-known network endpoints: port 111 over both TCP and UDP, as well as local Unix domain sockets.

When an RPC service launches on a Linux host, it performs the following steps:

  1. The service requests an available dynamic TCP or UDP port from the operating system.
  2. The service communicates with rpcbind locally, registering its assigned RPC program number, version number, protocol, and the port it acquired.
  3. rpcbind updates its internal lookup table with this mapping.

When an external client needs to invoke a remote procedure, the interaction proceeds through a two-phase workflow:

  1. Port Lookup: The client sends an initial query to rpcbind on port 111 of the server, requesting the port number associated with a specific RPC program number and version.
  2. Direct Execution: rpcbind replies with the correct port. The client then establishes a direct connection to that target port, bypassing rpcbind for the remainder of the session.

Managing and Inspecting rpcbind

Linux administrators can interact with rpcbind and view the current registration table using the rpcinfo command.

Running rpcinfo -p queries the local or remote rpcbind daemon and displays a table containing:

The daemon itself is managed like any standard Linux system service, typically via systemd using the systemctl status rpcbind command.

Security and Architectural Evolution

Because rpcbind acts as a gateway for remote execution discovery, it presents specific security risks if exposed directly to untrusted networks. Historically, misconfigured RPC port mappers have been exploited for amplification distributed denial-of-service (DDoS) attacks and network reconnaissance.

To mitigate these risks in modern Linux deployments: