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

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

The rpcinfo command is a powerful utility for interacting with Remote Procedure Call (RPC) services. It is primarily used for making RPC calls to an RPC server and reports its findings. This command is pivotal for system administrators and network engineers who need to manage and debug RPC services. It provides functionalities such as listing all registered RPC services, displaying operation statistics, and manipulating certain RPC service registrations. Its utilities are integral for maintaining the functionality and security of networks that rely on RPC.

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

Code:

rpcinfo

Motivation:

Getting a complete list of all RPC services running on the localhost is essential for administrators to assess the types and versions of services available, their current statuses, and ensure they are adequate and secure. This comprehensive overview is crucial for auditing, as well as preparing for any maintenance or shutdown procedures that might affect these services.

Explanation:

  • rpcinfo: This command without any additional arguments simply outputs a detailed list of all the RPC services registered on the local host. It provides detailed information including the program numbers, versions, protocols, and ports, allowing a full assessment of local RPC activities.

Example output:

program vers proto   port
100000    2   tcp    111  portmapper
100000    2   udp    111  portmapper
100003    3   tcp   2049  nfs
100005    1   udp    757  mountd

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

Code:

rpcinfo -s localhost

Motivation:

A streamlined view that presents only essential details about RPC services is often preferable for quick checks or when needing to troubleshoot without additional clutter. This concise table format gives a snapshot of the current RPC landscape on the localhost without overwhelming with detail.

Explanation:

  • rpcinfo: Invokes the rpcinfo utility.
  • -s: The switch used to produce a concise overview of RPC services.
  • localhost: Specifies the local machine as the target, ensuring that the output pertains to services running on the current host.

Example output:

program version netid     address                service        owner
100000 2        tcp       0.0.0.0.111            portmapper     superuser
100003 3        tcp       0.0.0.0.2049           nfs            superuser

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

Code:

rpcinfo -m

Motivation:

It can be significantly beneficial for administrators to analyze and diagnose performance issues or ensure that the rpcbind operations are functioning properly by viewing their statistics. This can help pinpoint bottlenecks, uncover malicious activities, or ensure resources are being appropriately allocated.

Explanation:

  • rpcinfo: Calls the rpcinfo program.
  • -m: Requests a table of rpcbind statistics concerning operations performed on the localhost, displaying valuable insights into activities and frequencies.

Example output:

Program Version Proto  Netid  Remote_Addr      Needs_Auth
100000  2       tcp    *      0.0.0.0.111      No
100000  2       udp    *      0.0.0.0.111      No

Use case 4: Display list of entries of given service name (mountd) and version number (2) on a remote NFS share

Code:

rpcinfo -l remote_nfs_server_ip mountd 2

Motivation:

By examining services such as mountd on a remote NFS server, administrators can verify that specific services needed for network file storage are available and functioning as expected. This can be crucial for validating remote service accessibility, especially when troubleshooting connectivity or access issues.

Explanation:

  • rpcinfo: The command being executed.
  • -l: Used to list entries in an easy-to-read format.
  • remote_nfs_server_ip: Targeting the NFS server with provided IP address to assess RPC service entries related to this server.
  • mountd: The service name being queried.
  • 2: Specifies the version number of the service to filter or target specific instances.

Example output:

Program Version Protocol  Port 
100005   2      udp       635
100005   2      tcp       636

Use case 5: Delete the registration for version 1 of the mountd service for all transports

Code:

rpcinfo -d mountd 1

Motivation:

Security and resource management occasionally require that outdated or unnecessary service registrations be purged from the network. By using this command, administrators can remove specific service versions no longer needed, thus reducing potential attack surfaces and ensuring adherence to best security practices.

Explanation:

  • rpcinfo: The command in use.
  • -d: The delete option, which forces the removal of the specified service registration.
  • mountd: The service identifier targeted for deletion.
  • 1: Indicates the version of the mountd service being de-registered.

Example output:

Deleted service registration for mountd version 1.

Conclusion:

The rpcinfo command offers a suite of capabilities that are essential for maintaining the operational integrity and security of RPC-based systems. By understanding and utilizing its various options, administrators and network professionals can effectively manage RPC services within their networks, ensuring a robust and responsive system environment.

Related Posts

Mastering the 'tre' Command (with examples)

Mastering the 'tre' Command (with examples)

The ’tre’ command is a powerful tool for visualizing the structure of directories and files in a hierarchical format.

Read More
How to Compare Font Differences Using 'ftxdiff' (with examples)

How to Compare Font Differences Using 'ftxdiff' (with examples)

The ftxdiff command is a tool provided by Apple that allows developers and designers to compare differences between two font files.

Read More
How to Use the Command 'git locked' (with Examples)

How to Use the Command 'git locked' (with Examples)

The git locked command is a part of the git-extras toolkit, offering a convenient way to list all locked files in a Git repository.

Read More