How to use RPCAllowIP option

+1 vote

Hello,

I'm very new in multichain. I followed getting started tutorial provided by your website successfully. Now I was following another tutorial by Sam Bawne https://samsclass.info/141/proj/pMult2.htm, I have no problem with it, but I was wondering how can I execute commands on a remote node connecting to the same chain using the RPCallowip.

Here is what I have:

Server 1 (Poller) with IP 192.168.1.8, server 2 (Voter) with IP 192.168.1.9 and they are both connected to chain Survey. 

Config file of Poller:

rpcuser=multichainrpc

rpcpassword=1**************

-------------------------------------------

Config file of Voter:

rpcuser=multichainrpc

rpcpassword=2**************

rpcport=2222

rpcallowip=192.168.1.8 (last2 lines I added them but I'm not sure)

-------------------------------------------

And this is the php script executed on Poller (as I understood, it will execute getinfo command on the Poller server bcz of this 'http://127.0.0.1:2222/'  ).

<?php
echo "<h1>Information About the Survey Blockchain</h1>";
$a = 'curl -s --user multichainrpc:1**************​ --data-binary \'';
$b = '{"jsonrpc": "1.0", "id":"curltest", "method": "getinfo", "params": [';
$c = '] }\' -H "content-type: text/plain;" http://127.0.0.1:2222/';
$cmd = $a . $b . $c;
$ret=system($cmd);

?>

----------------------------------------------------

I want to to know what should I change to make this script executes the getinfo command on the second server with IP 192.168.1.9 when I run it on the first server by php info.php. 

 

  

 

asked Aug 19, 2017 by Tahani Qadi
edited Aug 19, 2017 by Tahani Qadi

1 Answer

+1 vote
Hi,

 

if all the nodes are on the same subnet (192.168.1), you could use:

 

-rpcallowip=192.168.1.0/24

 

so that any 192.168.1.x node could send a request to any 192.168.1.y other node.

you can also read about cidr notation here: https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#IPv4_CIDR_blocks

 

if you have some more complex needs.

 

hth,

 

Sébastien
answered Aug 21, 2017 by sgaide
...