TCP/IP Service: Remote Procedure Call (RPC)

Discussion in 'Linux Networking' started by Jarret W. Buse, Nov 13, 2013.

  1. Jarret W. Buse

    Jarret W. Buse Well-Known Member Staff Writer

    Jul 3, 2013
    Likes Received:
    TCP/IP Service: Remote Procedure Call (RPC)

    Remote Procedure Calls are a collection of library functions and tools which was developed by Sun Microsystems. RPCs are used to allow programs on one system to remotely execute code in another address. The other address can be a remote system on a network but can also be a different processor in the local system. Even on the network the Server system can be on a LAN, WAN or even the Internet.

    NOTE: The RPC Address consists of the RPC program number, version number, and the Transport Address. The Transport Address is made up of the network IP address and the Transport Control Protocol (TCP) or User Datagram Protocol (UDP) Port Number. Be aware that Remote Procedure Calls can fail, especially when using UDP. UDP is the default unless the information cannot fit in a UDP frame, then it is sent as TCP.

    The RPC Service allows programmers to write code to be used on multiple systems without needing to write code to manage the remote execution.

    Before we start the RPC procedures, let’s look at some important terms:

    Client – The program on a system requesting the execution of code
    Server – The program accepting the request from the client on a system where the remote code is to be executed
    Stub – Portion of code to convert addresses and parameters between Client and Server systems
    Marshalling – Placing parameters and addresses in a message to send to the Server
    Unmarshalling – Removes parameters and addresses from a message when received by the Server to be sent to the RPC Server Service

    NOTE: The Server refers to the code accepting the Client’s request. By no means does this always occur on a server system. Remember that the Remote Procedure Call can be made to another processor on the same system. The Stub addresses can also be between two processors on the same system.

    Remote Procedure Calls are performed in the following order:
    1. The Client on a system calls the Client Stub passing it information
    2. Client Stub marshalls information to be sent to the Server
    3. Local OS sends message to Server over the network
    4. Server OS accepts message from network and sends it to the Server Stub
    5. Server Stub unmarshalls information to be used by the Server
    6. Server uses information to perform server procedures
    7. Output information is sent back to client if any output is generated
    The Stub can handle conversion of parameter types between systems which have a different OS. The functions used by the Stub can convert parameters from integers to floating point decimals and vice versa.

    Remote Procedure Calls are usually sent over TCP/IP, but can be sent over other Network Protocols. TCP/IP is used over the Internet and some LANs or WANs may use another protocol.

    On a Linux system, the RPC Services is a collection of procedures, each with a name and program number. The list of program names and numbers are kept in /etc/rpc and an example is shown:

    # This file contains user readable names that can be used in place of rpc
    # program numbers.
    portmapper 100000 portmap sunrpc
    rstatd 100001 rstat rstat_svc rup perfmeter
    rusersd 100002 rusers
    nfs 100003 nfsprog
    ypserv 100004 ypprog
    mountd 100005 mount showmount
    ypbind 100007
    walld 100008 rwall shutdown
    yppasswdd 100009 yppasswd
    etherstatd 100010 etherstat
    rquotad 100011 rquotaprog quota rquota
    sprayd 100012 spray
    3270_mapper 100013
    rje_mapper 100014
    selection_svc 100015 selnsvc
    database_svc 100016
    rexd 100017 rex
    alis 100018
    sched 100019
    llockmgr 100020
    nlockmgr 100021
    x25.inr 100022
    statmon 100023
    status 100024
    bootparam 100026
    ypupdated 100028 ypupdate
    keyserv 100029 keyserver
    tfsd 100037
    nsed 100038
    nsemntd 100039
    ypxfrd 100069
    pcnfsd 150001
    amd 300019 amq
    sgi_fam 391002
    ugidd 545580417
    fypxfrd 600100069 freebsd-ypxfrd
    bwnfsd 788585389

    The first name in each row is the Server name (RPC Program), the second column is the RPC program number. Any names after the number are aliases for the Server Name. Each column can be separated by a tab or any number of spaces.

    When a port is used there is not a default Port Number. A program called the Port Mapper is used to reserve the port for the specified program. The Client system can query the Server system’s Port Mapper for the Server Port Number. The Server’s Port Number is returned to the Port Mapper to be used to create the RPC Address.

    The Linux Port Mapper is located in /sbin/portmap or can be /usr/sbin/rpc.portmap. If the Port Mapper dies for any reason then all mapped port information is lost and RPC is unavailable on that system. When the port information is lost the RPC service must be restarted or the system rebooted to restore RPC capabilities.

    NOTE: The Port Mapper requires no configuration, but if needed, should be in your boot script.

    Attached Files:

    • slide.jpg
      File size:
      29.3 KB
    DevynCJohnson likes this.
  2. Abhishek Bajpai

    Abhishek Bajpai New Member

    Apr 23, 2014
    Likes Received:
    Hello Sir,
    First of all thnx for nice information regarding RPC.
    Sir, I have a question please ans me .
    can we split procedures on different networked server ?
    like procedure 1 on server 1 and procedure 2 on server 2 on same time .
    or different procedure on different port ..?

Share This Page