RPC not connecting to remote host for testnet #20742

issue bitstein opened this issue on December 22, 2020
  1. bitstein commented at 2:29 AM on December 22, 2020: contributor

    When I try to call bitcoin-cli on a remote host, I have success on mainnet, but I receive a connection error on testnet. Both work fine on localhost.

    Expected behavior

    I would expect that given similar bitcoin.conf settings, I would be able to connect to both mainnet and testnet successfully.

    Actual behavior

    See intro.

    To reproduce

    I have the following in my bitcoin.conf:

    rpcallowip=127.0.0.1/0
    rpcallowip=192.168.1.0/24
    ...
    rpcbind=0.0.0.0
    rpcbind=<LAN IP>
    

    I have tried placing rpcallowip both on its own and under [test], and rpcbind is included under [test]. My local network is confirmed to be on 192.168.1.0/24. I even tried 0.0.0.0/0 with no luck.

    System information

    I am using Bitcoin Core version v0.19.0.1 on the remote host and v0.20.1.0 locally.

    The remote host is running Ubuntu 20.04.1.

  2. bitstein added the label Bug on Dec 22, 2020
  3. sipa commented at 2:31 AM on December 22, 2020: member

    Exactly how do you invoke bitcoind and bitcoin-cli?

  4. bitstein commented at 2:36 AM on December 22, 2020: contributor

    On my remote host, I run the following to boot up mainnet and testnet (with my config handling the rest):

    $ bitcoind
    $ bitcoind -testnet
    

    On my local machine, I have a simple config with rpcconnect to my remote host and the rpcuser and rpcpassword. I run the following for mainnet and testnet, respectively:

    $ bitcoin-cli getblockchaininfo
    $ bitcoin-cli -testnet getblockchaininfo
    
  5. jamesob commented at 3:26 AM on December 22, 2020: member

    I can also confirm that I'm unable to access a testnet RPC server across hosts with similar config:

    server's bitcoin.conf

    testnet=1
    rpcallowip=0.0.0.0/0
    rpcallowip=::/0
    rpcbind=0.0.0.0
    rpcuser=james
    rpcpassword=test
    
    [test]
    rpcallowip=0.0.0.0/0
    rpcallowip=::/0
    rpcbind=0.0.0.0
    rpcuser=james
    rpcpassword=test
    

    Started with

    ./src/bitcoind -testnet
    
    server % ip addr show | grep 'inet 192'
        inet 192.168.4.23/22 brd 192.168.7.255 scope global dynamic noprefixroute wlp2s0
    
    server % lsof -i | grep 18332
    bitcoind   9602         james   11u  IPv4 2572992      0t0  TCP *:18332 (LISTEN)
    

    From client host

    client % sudo nmap -p 18332 -T4 192.168.4.23
    Starting Nmap 7.70 ( https://nmap.org ) at 2020-12-21 21:37 EST
    Nmap scan report for 192.168.4.23
    Host is up (0.014s latency).
    
    PORT      STATE    SERVICE
    18332/tcp filtered unknown
    MAC Address: 04:EA:56:80:81:17 (Unknown)
    
    Nmap done: 1 IP address (1 host up) scanned in 0.57 seconds
    
    client % ./src/bitcoin-cli -testnet -rpcconnect=192.168.4.23 help
    error: Could not connect to the server 192.168.4.23:18332 (error code 1 - "EOF reached")
    
    Make sure the bitcoind server is running and that you are connecting to the correct RPC port.
    
  6. practicalswift commented at 3:35 AM on December 22, 2020: contributor

    @jamesob

    Judging from the nmap output it looks like port 18332 is being filtered?

    Can you establish a TCP connection to 192.168.4.23:18332 from the host client using say nc?

  7. jamesob commented at 3:40 AM on December 22, 2020: member

    Hm, can't. So maybe this is trouble with my networking config?

    client % nc -vz 192.168.4.23 18332
    192.168.4.23: inverse host lookup failed: Unknown host
    (UNKNOWN) [192.168.4.23] 18332 (?) : No route to host
    

    On another client host I was seeing similar behavior but remember getting more sensible nc output. Will verify.

  8. MarcoFalke commented at 8:28 AM on December 22, 2020: member

    I am using Bitcoin Core version v0.19.0.1 on the remote host and v0.20.1.0 locally.

    Probably unrelated to this issue, but generally bitcoin-cli is only compatible with a server of the exactly same version.

  9. bitstein commented at 12:26 PM on December 22, 2020: contributor

    generally bitcoin-cli is only compatible with a server of the exactly same version.

    Thanks, I updated and will be sure to keep them in sync in the future.

    Judging from the nmap output it looks like port 18332 is being filtered?

    This turned out to be my issue. I opened up 18332 in the firewall, and it works now. Thank you. Closing.

  10. bitstein closed this on Dec 22, 2020

  11. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 09:14 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me