Default behavior of binding to all interfaces for RPC server not working #9272

issue JustinTArthur opened this issue on December 4, 2016
  1. JustinTArthur commented at 6:12 AM on December 4, 2016: contributor

    Describe the issue

    The --help for rpcbind suggests that the default behavior is to bind to all interfaces. However, in Core 0.13.1, I noticed that if rpcbind is left out of the config, the RPC server is either only bound to the loopback interface or only bound to the IPv6 port.

    Can you reliably reproduce the issue?

    Yes. It fails differently, depending on whether or not you've supplied rpcallowip

    Reproduction Scenario 1

    Fails silently, only binds to loopback interface.

    server=1
    rpcuser=something
    rpcpassword=somethingelse
    
    • Binds to 127.0.0.1:8332
    • Binds to [fe80::1%lo0]:8332

    Reproduction Scenario 2

    Error message in log, only binds to all interfaces for IPv6.

    server=1
    rpcuser=something
    rpcpassword=somethingelse
    rpcallowip=0.0.0.0/0
    rpcallowip=::/0
    
    • Binding RPC on address 0.0.0.0 port 8332 failed. reported in debug.log.
    • Binds to [::]:8332

    What version of bitcoin-core are you using?

    0.13.1

    Machine specs:

    • OS: Apple OS X 10.11.6 (15G1108)
    • CPU: 2.7 GHz 12-Core Intel Xeon E5
    • RAM: 64 GB 1866 MHz DDR3 ECC
    • Disk size: 1TB
    • Disk Type (HD/SDD): SSD
  2. fanquake added the label RPC/REST/ZMQ on Dec 4, 2016
  3. laanwj commented at 11:44 AM on December 5, 2016: member

    Are you sure this is really the case?

    That message:

    Binding RPC on address 0.0.0.0 port 8332 failed. reported in debug.log.

    Means that it can't bind on 0.0.0.0 - which usually means that the IPv6 any address works as 'catchall' for both incoming IPv4 and IPv6 connections. This is the case on some OSes, making it unnecessary to have two binds.

    Have you tried connecting to the port?

  4. laanwj commented at 11:46 AM on December 5, 2016: member

    BTW: the default behavior is, and always has been, to bind on all interfaces if -rpcallowip is set. If not bind on localhost only [both given no explicit binds]. This is a security feature.

  5. tiabc commented at 12:23 PM on May 29, 2017: none

    I've just faced the same problem. Maybe it's worth noting this behavior in bitcoind help?

    Because although the behavior has always been such, the option is unambiguously described that it binds to all interfaces by default:

      -rpcbind=<addr>
           Bind to given address to listen for JSON-RPC connections. Use
           [host]:port notation for IPv6. This option can be specified
           multiple times (default: bind to all interfaces)
    

    I had to google some more time to find out an answer.

  6. blob42 referenced this in commit bac5eef1d1 on Nov 16, 2018
  7. blob42 referenced this in commit d61b44b559 on Nov 18, 2018
  8. laanwj closed this on Aug 19, 2019

  9. sidhujag referenced this in commit 74f4e6d259 on Aug 19, 2019
  10. PastaPastaPasta referenced this in commit f465bec708 on Jun 27, 2021
  11. PastaPastaPasta referenced this in commit dcaabc5862 on Jun 28, 2021
  12. PastaPastaPasta referenced this in commit 0df3e73a1e on Jun 29, 2021
  13. PastaPastaPasta referenced this in commit be419b4062 on Jul 1, 2021
  14. PastaPastaPasta referenced this in commit cf19d789c2 on Jul 1, 2021
  15. PastaPastaPasta referenced this in commit 91cc5488af on Jul 12, 2021
  16. DrahtBot locked this on Dec 16, 2021

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-13 15:15 UTC

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