<p>Make sure to set</p>

<pre><code>rpcallowip=&lt;ip&gt;
</code></pre>

<p>for each of your remote IPs, to whitelist them.</p>

<p>You can also use a netmask instead of IP. If you have a dynamic IP, use this feature!</p>

<p>For example, if your laptop's IP always starts with <code>237.94</code>, you can set it to</p>

<pre><code>rpcallowip=237.94.0.0/255.255.0.0
</code></pre>

<p>Then it'll allow all IPs that start with those numbers. Make sure to set a really strong password, though.</p>

CC BY-SA 4.0
2018-08-22T13:27:47.807Z
2018-08-22T16:52:54.947Z
2018-08-22T16:52:54.947Z
MCCCS
<p>code: </p>

<pre><code>from bitcoinrpc.authproxy import AuthServiceProxy
class ProxyService:
    def getProxy(self) -&gt; AuthServiceProxy:
        return AuthServiceProxy("http://%s:%s@xx.xx.xx.xx:8332" % ("xx", "xxx")) # this only works locally as 127.0.0.1
</code></pre>

<p>bitcon.config</p>

<pre><code>datadir=/xxxx/Bitcoin
dbcache=2000
txindex=1
server=1
rpcuser=xx
rpcpassword=xx
rpcport=8332
disablewallet=1
</code></pre>

<p>I am running this on Ubuntu droplet. connection works when i connect locally as 127.0.0.1:8332   </p>

<p>but when i try connection to the ip of my node <strong>(locally or remotely)</strong> I get "connection refused" </p>

<p>also i can confirm my node is up </p>

<p><a href="https://i.sstatic.net/kdVqP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/kdVqP.png" alt="enter image description here"></a></p>

<bitcoind><json-rpc>
json-rpc api works locally but getting "Connection Refused" remotely
Sonic Soul
# json-rpc api works locally but getting "Connection Refused" remotely

(Asked by: username_0 on 2018-08-22)

code:

```
from bitcoinrpc.authproxy import AuthServiceProxy
class ProxyService:
    def getProxy(self) -> AuthServiceProxy:
        return AuthServiceProxy("http://%s:%s@xx.xx.xx.xx:8332" % ("xx", "xxx")) # this only works locally as 127.0.0.1

```

bitcon.config

```
datadir=/xxxx/Bitcoin
dbcache=2000
txindex=1
server=1
rpcuser=xx
rpcpassword=xx
rpcport=8332
disablewallet=1

```

I am running this on Ubuntu droplet. connection works when i connect locally as 127.0.0.1:8332

but when i try connection to the ip of my node **(locally or remotely)** I get "connection refused"

also i can confirm my node is up

[![enter image description here](https://i.sstatic.net/kdVqP.png)](https://i.sstatic.net/kdVqP.png)

**Tags:** bitcoind, json-rpc


---

## 1 answers

### Answer by username_1 on 2018-08-22. Score: 3 | Accepted answer

Make sure to set

```
rpcallowip=<ip>

```

for each of your remote IPs, to whitelist them.

You can also use a netmask instead of IP. If you have a dynamic IP, use this feature!

For example, if your laptop's IP always starts with `237.94`, you can set it to

```
rpcallowip=237.94.0.0/255.255.0.0

```

Then it'll allow all IPs that start with those numbers. Make sure to set a really strong password, though.


---

