<p>To expand on the answer from @Slavik Svyrydiuk : it only worked for me when starting the daemon with those options (-rpcbind=0.0.0.0 -rpcallowip=192.168.1.0/24).</p>
<p>If I set those in the conf and just started it like normal (sudo bitcoind -daemon) then it WOULD NOT open the port to external connections.  It works only if I start the daemon with those settings like this:</p>
<p><code>sudo bitcoind -daemon -rpcbind=0.0.0.0 -rpcallowip=192.168.1.0/24</code></p>

CC BY-SA 4.0
2021-06-14T03:47:07.827Z
2021-06-14T04:07:53.583Z
2021-06-14T04:07:53.583Z
coolshoeshine
<p>Finally,I create a proxy to solve it. <strong>I am not sure if there is a risk of this code</strong>.</p>

<p><a href="https://gist.github.com/toknT/195dc5bf6d5cb6c1cb89cd424ee783bf" rel="nofollow noreferrer">https://gist.github.com/toknT/195dc5bf6d5cb6c1cb89cd424ee783bf</a></p>



<pre><code>var httpProxy = require('http-proxy');
const rpcPort = process.env.RPC_PORT;
const exportPort = process.env.EXPORT_PORT;

httpProxy.createProxyServer({ target: `http://127.0.0.1:${rpcPort}` }).listen(exportPort);
</code></pre>

CC BY-SA 4.0
2019-10-29T04:16:34.507Z
2019-10-29T04:16:34.507Z
Toknsit Toknsit
<p>The problem is that you apply wrong options values for <strong>-rpcallowip</strong> and <strong>-rpcbind</strong>.</p>

<pre><code>-rpcbind=127.0.0.1
</code></pre>

<p>This one tells bitcoind to bind RCP server to <em>127.0.0.1</em>(localhost). That means it will be available from the same host only.</p>

<pre><code>-rpcallowip=0.0.0.0/24
</code></pre>

<p>0.0.0.0/24 means <strong>Class C</strong> network with IP address range 0.0.0.1 - 0.0.0.254</p>

<p>The correct options in your case are:</p>

<pre><code>-rpcallowip=192.168.1.0/24 -rpcbind=0.0.0.0
</code></pre>

<p>or even more secure:</p>

<pre><code>-rpcallowip=192.168.1.155 -rpcbind=192.168.1.132
</code></pre>

CC BY-SA 4.0
2021-01-29T15:18:09.790Z
Solved my issue. I added the 2 config values to my bitcoin.conf.  Well done answer @Slavik
qxotk
CC BY-SA 4.0
2021-01-29T15:19:15.117Z
Also, there is a well-documented sample bitcoin.conf file here: https://github.com/bitcoin/bitcoin/blob/master/share/examples/bitcoin.conf
qxotk
CC BY-SA 4.0
2019-10-29T09:26:10.937Z
2019-10-29T09:26:10.937Z
Slavik Svyrydiuk
<h2>cannot call rpc api from other machine in same local network</h2>

<p>There is a regtest node in my local network , I can call <strong>rpc api</strong> only from the node's machine,not my local machine.</p>

<p>I know <code>rpcallowip</code> is changed in recent release <a href="https://bitcoin.org/en/release/v0.18.0#configuration-option-changes" rel="nofollow noreferrer">https://bitcoin.org/en/release/v0.18.0#configuration-option-changes</a></p>

<p>http clinet <code>httpie</code></p>

<p>my local machine's ip: <code>192.168.1.155</code></p>

<p>btc node's ip: <code>192.168.1.132</code></p>

<p>the port <code>8332</code> is opened <code>sudo ufw allow 8332</code>. </p>

<h1>bitcoind version</h1>



<pre><code>$ bitcoind -version                 
# Bitcoin Core Daemon version v0.18.0.0-g2472733a24a9364e4c6233ccd04166a26a68cc65
</code></pre>

<h1>command start bitcoind</h1>

<p>I start regtest , and my ip is 192.168.1.155</p>



<pre><code>bitcoind -regtest -deprecatedrpc=generate -printtoconsole -rpcuser=user -rpcpassword=password -rpcallowip=0.0.0.0/24 -rpcbind=127.0.0.1  -server -rpcport=8332
</code></pre>

<h2>client request</h2>



<pre><code># request from btc node's machine
http POST http://user:password@127.0.0.1:8332 jsonrpc="2.0" method="getblockchaininfo" id=1
# successed

# request from my local machine 192.168.1.155
http POST http://user:password@192.168.1.132:8332 jsonrpc="2.0" method="getblockchaininfo" id=1
# http: error: ConnectionError: HTTPConnectionPool(host='192.168.1.132', port=8332): Max retries exceeded with url: / (Caused by NewConnectionError('&lt;urllib3.connection.HTTPConnection object at 0x7fd6e288f438&gt;: Failed to establish a new connection: [Errno 111] Connection refused',)) while doing POST request to URL: http://user:password@192.168.1.132:8332/
</code></pre>

CC BY-SA 4.0
2019-10-14T07:42:40.297Z
`rpcbind` should probably be `0.0.0.0`
Raghav Sood
CC BY-SA 4.0
2019-10-14T08:03:53.017Z
@RaghavSood `bitcoind -regtest -deprecatedrpc=generate -printtoconsole -rpcuser=user -rpcpassword=password -rpcallowip=0.0.0.0/24 -rpcbind=0.0.0.0  -server -rpcport=8332` still return `Failed to establish a new connection`.
Toknsit Toknsit
CC BY-SA 4.0
2019-10-14T08:31:26.133Z
Try changing rpcallowip to `192.168.1.155`, I believe some (all?) of the RPC options don't accept netmasks
Raghav Sood
CC BY-SA 4.0
2019-10-14T08:53:38.980Z
@RaghavSood  It still doesn't work. What's your bitcoind versiosn?
Toknsit Toknsit
CC BY-SA 4.0
2019-10-27T21:48:43.533Z
@ToknsitToknsit  I had a simil problem and the problem was the local network, and the example you use more modem to connect?
vincenzopalazzo
CC BY-SA 4.0
2019-10-29T02:46:35.507Z
@vincenzopalazzo I try one week on it and give up .But solve it by an other way:  using a **proxy**  to request it from remote.
Toknsit Toknsit
CC BY-SA 4.0
2019-10-30T06:00:19.823Z
@RaghavSood sorry your are right , the netmask is wrong. I use `-rpcallowip=192.168.1.155 -rpcbind=127.0.0.1` in Oct 14 , It should be`-rpcallowip=192.168.1.155 -rpcbind=0.0.0.0`  from Slavik Svyrydiuk's ansower.
Toknsit Toknsit
<bitcoind><json-rpc><regtest>
Cannot call rpc api from other machine in same local network
Toknsit Toknsit
# Cannot call rpc api from other machine in same local network

(Asked by: username_0 on 2019-10-14)

cannot call rpc api from other machine in same local network
There is a regtest node in my local network , I can call rpc api only from the node's machine,not my local machine.
I know rpcallowip is changed in recent release https://bitcoin.org/en/release/v0.18.0#configuration-option-changes
http clinet httpie
my local machine's ip: 192.168.1.155
btc node's ip: 192.168.1.132
the port 8332 is opened sudo ufw allow 8332. 
bitcoind version
$ bitcoind -version                 
# Bitcoin Core Daemon version v0.18.0.0-g2472733a24a9364e4c6233ccd04166a26a68cc65

command start bitcoind
I start regtest , and my ip is 192.168.1.155
bitcoind -regtest -deprecatedrpc=generate -printtoconsole -rpcuser=user -rpcpassword=password -rpcallowip=0.0.0.0/24 -rpcbind=127.0.0.1  -server -rpcport=8332

client request
# request from btc node's machine
http POST http://user:password@127.0.0.1:8332 jsonrpc="2.0" method="getblockchaininfo" id=1
# successed

# request from my local machine 192.168.1.155
http POST http://user:password@192.168.1.132:8332 jsonrpc="2.0" method="getblockchaininfo" id=1
# http: error: ConnectionError: HTTPConnectionPool(host='192.168.1.132', port=8332): Max retries exceeded with url: / (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused',)) while doing POST request to URL: http://user:password@192.168.1.132:8332/

**Tags:** bitcoind, json-rpc, regtest

> **Comments:**
> **username_1**: `rpcbind` should probably be `0.0.0.0`  
> **username_0**: @RaghavSood `bitcoind -regtest -deprecatedrpc=generate -printtoconsole -rpcuser=user -rpcpassword=password -rpcallowip=0.0.0.0/24 -rpcbind=0.0.0.0  -server -rpcport=8332` still return `Failed to establish a new connection`.  
> **username_1**: Try changing rpcallowip to `192.168.1.155`, I believe some (all?) of the RPC options don't accept netmasks  
> **username_0**: @RaghavSood  It still doesn't work. What's your bitcoind versiosn?  
> **username_2**: @ToknsitToknsit  I had a simil problem and the problem was the local network, and the example you use more modem to connect?  
> **username_0**: @username_2 I try one week on it and give up .But solve it by an other way:  using a **proxy**  to request it from remote.  
> **username_0**: @RaghavSood sorry your are right , the netmask is wrong. I use `-rpcallowip=192.168.1.155 -rpcbind=127.0.0.1` in Oct 14 , It should be`-rpcallowip=192.168.1.155 -rpcbind=0.0.0.0`  from username_4's ansower.  

---

## 3 answers

### Answer by username_4 on 2019-10-29. Score: 5 | Accepted answer

The problem is that you apply wrong options values for -rpcallowip and -rpcbind.
-rpcbind=127.0.0.1

This one tells bitcoind to bind RCP server to 127.0.0.1(localhost). That means it will be available from the same host only.
-rpcallowip=0.0.0.0/24

0.0.0.0/24 means Class C network with IP address range 0.0.0.1 - 0.0.0.254
The correct options in your case are:
-rpcallowip=192.168.1.0/24 -rpcbind=0.0.0.0

or even more secure:
-rpcallowip=192.168.1.155 -rpcbind=192.168.1.132

> **Comments:**
> **username_5**: Solved my issue. I added the 2 config values to my bitcoin.conf.  Well done answer @Slavik  
> **username_5**: Also, there is a well-documented sample bitcoin.conf file here: https://github.com/bitcoin/bitcoin/blob/master/share/examples/bitcoin.conf  

---

### Answer by username_3 on 2021-06-14. Score: 0

To expand on the answer from @username_4 : it only worked for me when starting the daemon with those options (-rpcbind=0.0.0.0 -rpcallowip=192.168.1.0/24).

If I set those in the conf and just started it like normal (sudo bitcoind -daemon) then it WOULD NOT open the port to external connections. It works only if I start the daemon with those settings like this:

`sudo bitcoind -daemon -rpcbind=0.0.0.0 -rpcallowip=192.168.1.0/24`


---

### Answer by username_0 on 2019-10-29. Score: 0

Finally,I create a proxy to solve it. I am not sure if there is a risk of this code.
https://gist.github.com/toknT/195dc5bf6d5cb6c1cb89cd424ee783bf
var httpProxy = require('http-proxy');
const rpcPort = process.env.RPC_PORT;
const exportPort = process.env.EXPORT_PORT;

httpProxy.createProxyServer({ target: `http://127.0.0.1:${rpcPort}` }).listen(exportPort);


---

