Analyzing RPC Services with rpcinfo (with examples)

Analyzing RPC Services with rpcinfo (with examples)

Introduction

The rpcinfo command is a handy utility that allows users to make Remote Procedure Call (RPC) calls to an RPC server and provides information about the available services. It is a powerful tool for system administrators and developers who need to troubleshoot or analyze RPC-based applications and network services.

This article will explore eight different use cases of the rpcinfo command, each showcasing a specific functionality and providing both the command code examples and the expected output. Let’s dive in!

Use Case 1: Show full table of all RPC services registered on localhost

Command:

rpcinfo

Motivation:

This use case is useful when you want to retrieve a comprehensive list of all RPC services registered on the local machine. It provides an overview of the available services and their corresponding RPC program numbers.

Explanation:

The command rpcinfo without any additional arguments will display a full table of all RPC services registered on the local machine (localhost). The table includes the RPC program number, version, transport protocol, and service name.

Example Output:

program version  protocol     port
100000    4    tcp6         111  portmapper
100000    3    tcp6         111  portmapper
100000    2    tcp6         111  portmapper
100000    4    udp6         111  portmapper
100000    3    udp6         111  portmapper
100000    2    udp6         111  portmapper
...

Use Case 2: Show concise table of all RPC services registered on localhost

Command:

rpcinfo -s localhost

Motivation:

This use case is suitable when you only need a concise overview of the RPC services registered on the localhost. It provides a summary of the services without displaying excessive details.

Explanation:

The -s option is used to display a concise table of all RPC services registered on the specified host, which in this case is localhost. Instead of displaying all the information like in the previous use case, this command presents a condensed version of the table that includes the service name and the program number.

Example Output:

prognum service
100000   portmapper
100021   nlockmgr
100024   status
...

Use Case 3: Display table of statistics of rpcbind operations on localhost

Command:

rpcinfo -m

Motivation:

This use case is helpful when you want to gather statistics about the rpcbind operations performed on the localhost. It provides insights into the usage of RPC services and their associated programs.

Explanation:

The -m option is used to display a table of statistics related to the rpcbind operations on the local machine. The statistics include the number of calls made, the number of successful replies, the number of failed replies, and the total number of outstanding calls.

Example Output:

Calls       Success     Badcalls    Badvers     Timedout
13          13          0           0           0

Use Case 4: Display list of entries of a given service name and version number on a remote NFS share

Command:

rpcinfo -l remote_nfs_server_ip mountd 2

Motivation:

This use case comes in handy when you need to retrieve information about a specific RPC service on a remote NFS server. It allows you to verify the availability and version of the service (e.g., mountd in this example).

Explanation:

The -l option is used to display a list of entries for the given service name (mountd) and version number (2) on the specified remote NFS server (remote_nfs_server_ip). This command can help in diagnosing issues with the service or ensuring compatibility with the desired version.

Example Output:

programs for 192.168.1.100:

program vers proto   port
 100005    2   tcp    892  mountd
 100005    2   udp    892  mountd

Use Case 5: Delete the registration for a specific version of a service for all transports

Command:

rpcinfo -d mountd 1

Motivation:

This use case is useful when you want to unbind or unregister a specific version of an RPC service. By deleting the registration, you can ensure that the service is not accessible by clients using that particular version.

Explanation:

The -d option followed by the service name (mountd) and version number (1) is used to delete the registration for the specified version of the service. This command removes the binding or registration, making the service inaccessible to clients relying on that particular version.

Example Output:

(Note: If there is no output, it means the deletion was successful.)

Conclusion

The rpcinfo command is a versatile tool that allows users to analyze and interact with RPC services running on a system. In this article, we explored various use cases of the rpcinfo command, from retrieving comprehensive service tables to analyzing statistics and managing service registrations. By understanding these functionalities, system administrators and developers can effectively troubleshoot and optimize RPC-based applications and network services.

Remember, the rpcinfo command offers even more options and capabilities beyond what we covered here, so make sure to consult the official documentation for further exploration. Happy RPC service analysis!

Related Posts

How to use the command 'ip link' (with examples)

How to use the command 'ip link' (with examples)

The ip link command is used to manage network interfaces in Linux.

Read More
hsw-cli (with examples)

hsw-cli (with examples)

1: Unlock the current wallet (timeout in seconds) hsw-cli unlock passphrase timeout This command is used to unlock the current wallet by providing the passphrase (password) and the timeout duration in seconds.

Read More
How to use the command 'mvn' (with examples)

How to use the command 'mvn' (with examples)

Apache Maven is a powerful tool used for building and managing Java-based projects.

Read More