Bitcoin Forum

Other => Beginners & Help => Topic started by: Soak on June 26, 2011, 06:51:47 PM



Title: [SOLVED] Connect to bitcoind from outside
Post by: Soak on June 26, 2011, 06:51:47 PM
Hello,

I have a dedicated server with a bitcoin daemon running somewhere on Internet. I try to reach it on another dedicated server (with JSON and PHP), the page loading for a while and nothing happen.

My bitcoin.conf file :
Quote
rpcuser=user
rpcpassword=pass
rpcallowip=client server IP
server=1
rpcport=8332

I launch daemon with ./bitcoind -daemon. ./bitcoind getinfo works.

curl http://user:pass@127.0.0.1:8332/ works.

Quote
admin@daemon:~$ curl http://user:pass@127.0.0.1:8332/
{"result":null,"error":{"code":-32700,"message":"Parse error"},"id":null}

curl http://user:pass@server daemon IP:8332/ don't work.

Quote
admin@daemon:~$ curl http://user:pass@server daemon IP:8332/
curl: (7) couldn't connect to host

Anybody can help me please?


Title: Re: Connect to bitcoind from outside
Post by: JoelKatz on June 26, 2011, 07:03:09 PM
Show us the 'netstat' line that shows the LISTENING socket on port 8332. Is it bound to 127.0.0.1?


Title: Re: Connect to bitcoind from outside
Post by: Soak on June 26, 2011, 07:06:52 PM
Show us the 'netstat' line that shows the LISTENING socket on port 8332. Is it bound to 127.0.0.1?

Quote
netstat
tcp        0      0 *:8332                  *:*                     LISTEN

Quote
netstat -an
tcp        0      0 0.0.0.0:8332            0.0.0.0:*               LISTEN

That's wrong? How I can modify that?


Title: Re: Connect to bitcoind from outside
Post by: JoelKatz on June 26, 2011, 07:17:02 PM
No, that's correct. Make sure the IP address you are connecting *from* is allowed in the conf file.


Title: Re: Connect to bitcoind from outside
Post by: Soak on June 26, 2011, 07:24:11 PM
No, that's correct. Make sure the IP address you are connecting *from* is allowed in the conf file.

Yes. The IP address in the conf file is correct. I added the server daemon "outside" IP in the conf file.

Quote
rpcallowip=client IP address
rpcallowip=server daemon IP address

Quote
admin@daemon:~$ curl http://user:pass@server daemon IP:8332/
curl: (7) couldn't connect to host

I don't know what to do now.. :(


Title: Re: Connect to bitcoind from outside
Post by: ShaggyB (BitCoinWorldMarket) on June 26, 2011, 07:31:57 PM
Do you have a firewall blocking incoming 8332 connections?


Title: Re: Connect to bitcoind from outside
Post by: Soak on June 26, 2011, 07:33:57 PM
Do you have a firewall blocking incoming 8332 connections?

How I can verify that please?


Title: Re: Connect to bitcoind from outside
Post by: ShaggyB (BitCoinWorldMarket) on June 26, 2011, 07:35:40 PM
If you are on a windows box, go to control panels and firewall settings. You will likely have to create a rule for that port. If you are on a linux box or other, i cant help you. Google is your friend for that.


Title: Re: Connect to bitcoind from outside
Post by: progre55 on June 26, 2011, 07:37:21 PM
what machine are you on? windows or linux?


Title: Re: Connect to bitcoind from outside
Post by: Soak on June 26, 2011, 07:39:36 PM
what machine are you on? windows or linux?

The daemon is currently running on Debian 6.0 64 bits.


Title: Re: Connect to bitcoind from outside
Post by: progre55 on June 26, 2011, 07:48:24 PM
then to check if you have any port restrictions on your current machine
Code:
iptables -L
with more info on iptables, refer to https://help.ubuntu.com/community/IptablesHowTo

other than that, make sure you're not behind a corporate network, or amazon clouds or anything =)


Title: Re: Connect to bitcoind from outside
Post by: Soak on June 26, 2011, 07:51:25 PM
Code:
iptables -L

Quote
root@daemon:~# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination


Title: Re: Connect to bitcoind from outside
Post by: progre55 on June 26, 2011, 07:58:52 PM
well it means you dont have any rules..
btw, try telneting to your machine from outsite
Code:
telnet host port
and see if it accepts connections. If not, then there's definitely a firewall somewhere outside your own machine.


Title: Re: Connect to bitcoind from outside
Post by: Soak on June 26, 2011, 08:10:15 PM
Code:
telnet host port

Quote
soak@client:~$ telnet 88.191.128.82 8332
Trying 88.191.128.82...
Connected to 88.191.128.82.
Escape character is '^]'.
Connection closed by foreign host.


Title: Re: Connect to bitcoind from outside
Post by: progre55 on June 26, 2011, 08:14:22 PM
Even I was able to connect to your server
Code:
progre55@progre55:~$ curl http://user:pass@88.191.128.82:8332/
{"result":null,"error":{"code":-32700,"message":"Parse error"},"id":null}

I dont see any problems.. so it's probably on your client side


Title: Re: Connect to bitcoind from outside
Post by: Soak on June 26, 2011, 08:20:39 PM
I dont see any problems.. so it's probably on your client side

Now that's works with rpcallowip=*.*.*.*, but don't with PHP and JSON.

Edit: Now it's ok since I explain my problem on the IRC channel of my hosting provider, by miracle the server is reachable on port 8332 (I don't give the IP of my server!). Awesome.