<ul>
<li><p>Bitcoin.conf does not use quotes in its definition of options. Your lines need to resemble <code>server=1</code> rather than <code>server='1'</code>. Your port number being zero is an artifact of this, which will not work as you need root permissions to bind to ports below 1024, which <code>bitcoind</code> does not and should not have.  </p></li>
<li><p><code>127.0.0.1</code> is the <a href="https://en.wikipedia.org/wiki/Localhost" rel="nofollow noreferrer">loopback address</a> used when you're connecting to yourself, rather than a normal routable IP address. For safety's sake the RPC port is not by default enabled to bind to routable IP addresses, such as your 10.0.0.0/24 range. By default, it will only bind to <code>127.0.0.1</code> and subsequently only be accessible on the host it is running on. </p></li>
</ul>

CC BY-SA 4.0
2018-12-24T18:12:35.043Z
2018-12-24T18:12:35.043Z
Claris
<p>I am simply trying to run <code>bitcoin-cli getinfo</code> on the same machine that my bitcoin node is running on (with <code>bitcoind -daemon</code>)</p>

<p>my bitcoin.conf file is as follows:</p>

<pre><code>server='1'
rpcuser='username'
rpcpassword='password'
rpcport='8332'
</code></pre>

<p>The error message I receive is:</p>

<pre><code>error: Could not connect to the server 127.0.0.1:0
</code></pre>

<p>This error is confusing me in two ways. First, my home network uses an Xfinity gateway (combined router/modem), and the local ip addresses look like <code>10.0.0.xx</code>, not <code>127.x.x.x</code>. Second, why is the error suggesting that it tried to connect on port 0? I have specified in bitcoin.conf that the rpc port is 8332. In this current state I can run a node, but I cannot make any rpc calls, rendering it useless for my purposes. Any advice on how to fix this issue? </p>

<blockchain><bitcoind><json-rpc><bitcoin-cli>
Can't use bitcoin-cli commands, error message says "could not connect" from localhost
Christian
# Can't use bitcoin-cli commands, error message says "could not connect" from localhost

(Asked by: username_0 on 2018-12-24)

I am simply trying to run bitcoin-cli getinfo on the same machine that my bitcoin node is running on (with bitcoind -daemon)
my bitcoin.conf file is as follows:
server='1'
rpcuser='username'
rpcpassword='password'
rpcport='8332'

The error message I receive is:
error: Could not connect to the server 127.0.0.1:0

This error is confusing me in two ways. First, my home network uses an Xfinity gateway (combined router/modem), and the local ip addresses look like 10.0.0.xx, not 127.x.x.x. Second, why is the error suggesting that it tried to connect on port 0? I have specified in bitcoin.conf that the rpc port is 8332. In this current state I can run a node, but I cannot make any rpc calls, rendering it useless for my purposes. Any advice on how to fix this issue?

**Tags:** blockchain, bitcoind, json-rpc, bitcoin-cli


---

## 1 answers

### Answer by username_1 on 2018-12-24. Score: 1

* Bitcoin.conf does not use quotes in its definition of options. Your lines need to resemble `server=1` rather than `server='1'`. Your port number being zero is an artifact of this, which will not work as you need root permissions to bind to ports below 1024, which `bitcoind` does not and should not have.
* `127.0.0.1` is the [loopback address](https://en.wikipedia.org/wiki/Localhost) used when you're connecting to yourself, rather than a normal routable IP address. For safety's sake the RPC port is not by default enabled to bind to routable IP addresses, such as your 10.0.0.0/24 range. By default, it will only bind to `127.0.0.1` and subsequently only be accessible on the host it is running on.


---

