Title: Can't get bitcoind to accept RPC connections from other machines Post by: tim_s_uk on April 02, 2013, 10:59:55 PM I'm running bitcoind on a headless Debian 6.0 machine with the following bitcoin.conf, and the option '-daemon'
Code: rpcuser=bitcoinrpc Code: user@server:~$ netstat -lp | grep bitcoind Code: rpcuser=bitcoinrpc Code: user@server:~$ netstat -lp | grep bitcoind Code: rpcallowip=*.*.*.* The log doesn't show any obvious reason. It includes the following lines: Code: Bound to [::]:8333 Any ideas why bitcoind isn't listening on port 8332 when I specify rpcallowip? I have seen this question on the forum a couple of times, but it either remains unsolved (https://bitcointalk.org/index.php?topic=159504.0), or the problem was something simple like a firewall or misspelling (http://stackoverflow.com/questions/6018304). I would like to allow other machines on my network to connect as miners (using poclbm). Title: Re: Can't get bitcoind to accept RPC connections from other machines Post by: ampbuster on June 05, 2013, 08:21:39 AM I'm having this same issue.
Title: Re: Can't get bitcoind to accept RPC connections from other machines Post by: tim_s_uk on June 06, 2013, 02:56:25 PM I've had a look at the code in bitcoinrpc.cpp, specifically the function StartRPCThreads().
The code attempts to open an IPv6 socket and then set the 'v6_only' option to false if the 'rpcallowip' option is used. This should cause the socket to listen for IPv4 connections, but on my system netstat doesn't show a listening IPv4 socket (see my original post). If the socket failed to open, or the 'rpcallowip' option is not used, the code opens a separate IPv4 socket. This means that when 'rpcallowip' is not used, separate IPv4 and IPv6 sockets are always used. When I modify the code (by setting fListening to false), so that it tries to open the IPv4 socket after opening the IPv4/IPv6 socket, I get the error: Error: An error occurred while setting up the RPC port 8332 for listening on IPv4: Address already in use which indicates that the combined IPv4/IPv6 socket is listening, although netstat doesn't show this. When I modify the code (by forcing set_option(v6_only(true)) and removing the if( !fListening... ) line), so that it always opens separate IPv4 and IPv6 sockets, things work as I expect them to: Code: user@server:~$ netstat -lp | grep bitcoind I assume that the IPv4/IPv6 socket just works on most systems. Unfortunately I can't see a work-around for systems like mine without recompiling bitcoind. Here are the changes I made: Code: diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp Title: Re: Can't get bitcoind to accept RPC connections from other machines Post by: Alexander The Great on June 06, 2013, 02:58:10 PM Im having trouble understanding any of this code..
Title: Re: Can't get bitcoind to accept RPC connections from other machines Post by: rolloffacliffpleaseanddie on June 06, 2013, 03:21:44 PM im not sure
Title: Re: Can't get bitcoind to accept RPC connections from other machines Post by: Eva Braun on June 06, 2013, 03:57:12 PM goodluck solving your problem
Title: Re: Can't get bitcoind to accept RPC connections from other machines Post by: tim_s_uk on June 07, 2013, 06:52:08 AM It turns out I was confused by the netstat output. It marks joint IPv4/6 sockets as tcp6
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=453272 bitcoind was listening on IPv4 socket 8332 all along, but my client was failing to connect for other reasons. With the IPv4 client able to connect on port 8332, my netstat output is: Code: user@server:~$ netstat -lp | grep bitcoind Title: Re: Can't get bitcoind to accept RPC connections from other machines Post by: Alexander The Great on June 07, 2013, 04:14:46 PM I dont understand this code..
Title: Re: Can't get bitcoind to accept RPC connections from other machines Post by: Nacsiar on June 07, 2013, 04:22:23 PM Code: user@server:~$ netstat -lp | grep bitcoind What firewall are you using? do you have iptables enabled (I assume not since you say others are connecting fine)? It sounds more like your gateway not forwarding ports from your external IP. Title: Re: Can't get bitcoind to accept RPC connections from other machines Post by: tim_s_uk on June 07, 2013, 06:11:08 PM Nacsiar - thanks for your reply.
My client was failing to connect because of a firewall issue, and I thought the problem was with bitcoind because netstat wasn't showing it listenting on IPv4 port 8332. It turns out that bitcoind was listening on a joint IPv4/6 socket on port 8332, it was just that netstat shows this joint socket as tcp6. If you don't set rpcallowip then separate IPv4 and IPv6 ports are opened (as you have shown). If you set rpcallowip (e.g. rpcallowip=*) then a single joint IPv4/6 port is opened. This works fine, but netstat shows it as tcp6 only, and the difference in behaviour confused me. I've got my client/server working now without any changes to bitcoind. Title: Re: Can't get bitcoind to accept RPC connections from other machines Post by: Nacsiar on June 07, 2013, 06:29:19 PM Glad to hear it, happy mining!
Title: Re: Can't get bitcoind to accept RPC connections from other machines Post by: rolloffacliffpleaseanddie on June 07, 2013, 06:52:12 PM cool idea
|