rpcinfo Command in Linux



The rpcinfo command in Linux is a powerful utility used to interact with Remote Procedure Call (RPC) services. It provides detailed information about the RPC services running on a system, including their status, version, and transport protocols. This command is essential for system administrators and network engineers who need to manage and debug RPC services.

Table of Contents

Here is a comprehensive guide to the options available with the rpcinfo command −

Understanding rpcinfo Command

The rpcinfo command is used to make RPC calls to an RPC server and report its findings. It can display information about RPC services, delete RPC registrations, and even make RPC calls to specific services.

By using the rpcinfo command, administrators can obtain a detailed list of all registered RPC services, check the availability of specific services, and even delete service registrations.

Let’s install it −

sudo apt install rpcbind
rpcinfo Command in Linux1

This command is essential for managing and troubleshooting RPC services, as it provides insights into the types and versions of services.

Syntax of rpcinfo Command

The basic syntax of the rpcinfo command is as follows −

rpcinfo [options] [host]
  • options − Various options to control the behavior of the command.
  • host − The hostname or IP address of the RPC server. If omitted, the local host is assumed.

rpcinfo Command Options

Here are some commonly used options with the rpcinfo command −

Options Description
-p Display a list of all registered RPC services on the specified host.
-s Display a concise list of all registered RPC services on the specified host.
-m Display a table of statistics of rpcbind operations on the specified host.
-l Display a list of entries of a given service name and version number on a remote NFS share.
-d Delete the registration for a specific RPC service.
-u Make an RPC call to a specific service using UDP.
-t Make an RPC call to a specific service using TCP.

Examples of rpcinfo Command in Linux

The rpcinfo command in Linux is a powerful utility for interacting with Remote Procedure Call (RPC) services. It allows administrators to query and display information about RPC services running on a system, including their status, version, and transport protocols.

Let's explore some examples of using the rpcinfo command with detailed explanations.

  • Display Full Table of All RPC Services on Localhost
  • Display Concise Table of All RPC Services on Localhost
  • Display Table of Statistics of rpcbind Operations on Localhost
  • Display List of Entries of a Given Service Name and Version Number on a Remote NFS Share
  • Delete the Registration for Version 1 of the mountd Service for All Transports
  • Make an RPC Call to a Specific Service Using UDP
  • Make an RPC Call to a Specific Service Using TCP
  • Display Information About a Specific RPC Service
  • Display Information About RPC Services on a Remote Host
  • Display Information About a Specific RPC Service on a Remote Host

Display Full Table of All RPC Services on Localhost

This command displays a detailed list of all RPC services registered on the local host. The output includes information such as program numbers, versions, protocols, and ports.

rpcinfo -p
rpcinfo Command in Linux2

This is useful for administrators to assess the types and versions of services available, their current statuses, and ensure they are adequate and secure.

Display Concise Table of All RPC Services on Localhost

This command provides a streamlined view that presents only essential details about RPC services.

rpcinfo -s localhost
rpcinfo Command in Linux3

It gives a snapshot of the current RPC landscape on the localhost without overwhelming with detail.

Display Table of Statistics of rpcbind Operations on Localhost

This command requests a table of rpcbind statistics concerning operations performed on the localhost.

rpcinfo -m
rpcinfo Command in Linux4

It displays valuable insights into activities and frequencies, which can help administrators analyze and diagnose performance issues.

Display List of Entries of a Given Service Name and Version Number on a Remote NFS Share

This command queries a remote server to determine which RPC services it provides, and reports information about those services, such as their version numbers, transport protocols, and endpoints.

rpcinfo -l remote_nfs_server_ip mountd 2
rpcinfo Command in Linux5

Delete the Registration for Version 1 of the mountd Service for All Transports

This command deletes the registration for version 1 of the mountd service for all transports.

rpcinfo -d mountd 1
rpcinfo Command in Linux6

This can be useful for cleaning up outdated or unnecessary service registrations.

Make an RPC Call to a Specific Service Using UDP

This command makes an RPC call to the NFS service (program number 100003) version 2 on the local host using UDP.

rpcinfo -u localhost nfs 2
rpcinfo Command in Linux7

It checks if the service is available and reports the result.

Make an RPC Call to a Specific Service Using TCP

This command makes an RPC call to the NFS service (program number 100003) version 3 on the local host using TCP.

rpcinfo -t localhost nfs 3 
rpcinfo Command in Linux8

It checks if the service is available and reports the result.

Display Information About a Specific RPC Service

This command displays detailed information about the NFS service (program number 100003) on the local host.

rpcinfo -p localhost 100003
rpcinfo Command in Linux9

It includes information such as version numbers, protocols, and ports.

Display Information About RPC Services on a Remote Host

This command displays a list of all registered RPC services on a remote host specified by its IP address.

rpcinfo -p remote_host_ip
rpcinfo Command in Linux10

It provides the same detailed information as the -p option for the local host.

Display Information About a Specific RPC Service on a Remote Host

This command displays detailed information about the NFS service (program number 100003) on a remote host specified by its IP address.

rpcinfo -p remote_host_ip 100003
rpcinfo Command in Linux11

It includes information such as version numbers, protocols, and ports.

Advanced Tips for rpcinfo Command

Using rpcinfo with grep

You can combine the rpcinfo command with grep to filter the output and find specific information. For example, to find all services using TCP, you can use −

rpcinfo -p | grep tcp
rpcinfo Command in Linux12

This command filters the output to show only services that use the TCP protocol.

Automating rpcinfo with Scripts

You can automate the use of rpcinfo in shell scripts to monitor RPC services and generate reports. For example, you can create a script to check the status of critical RPC services and send an alert if any service is down.

#!/bin/

List of critical RPC services
services=("nfs" "mountd" "rquotad")
#Check each service
for service in "${services[@]}"; do
	if ! rpcinfo -p | grep -q "$service"; then
		echo "Alert: $service is not running!"
	fi
done

This script checks if the specified services are running and prints an alert if any service is not found.

Conclusion

The rpcinfo command is a versatile and powerful tool for managing and debugging RPC services in Linux. By understanding its various options and how to use them, you can effectively monitor and troubleshoot RPC services on both local and remote hosts.

Whether you're a system administrator or a network engineer, mastering the rpcinfo command will enhance your ability to maintain a reliable and secure network environment.

Advertisements