1

I have a machine (A) running a Tezos node, with RPC port set to 8732. Its local IP is 192.168.1.200.

I have another machine (B), from the same network, from which I'd like to connect to the RPC of A.

On machine A I opened port 8732:

sudo iptables -A INPUT -p tcp --dport 8732 -j ACCEPT
sudo /sbin/iptables-save

Now, machine B should be able to do an RPC connection like this:

tezos-client --endpoint http://192.168.1.200:8732 rpc get /chains/main/blocks/head/protocols

But what it gets is:

Warning:
  Failed to acquire the protocol version from the node
  Rpc request failed:
     - meth: GET
     - uri: http://192.168.1.200:8732/chains/main/blocks/head/protocols
     - error: Unable to connect to the node: "Unix.Unix_error(Unix.ECONNREFUSED, "connect", "")"

Error:
  Rpc request failed:
     - meth: GET
     - uri: http://192.168.1.200:8732/describe/chains/main/blocks/head/protocols?recurse=no
     - error: Unable to connect to the node: "Unix.Unix_error(Unix.ECONNREFUSED, "connect", "")"

What did I do wrong? Do I have to set up a web server (nginx?) to handle the incoming HTTP request?

1

Verify the RPC is running by doing this on machine A

curl http://192.168.1.200:8732/chains/main/blocks/head/protocols

If that does not return, then you don't have the RPC setup correctly. If that does return, next step is to verify B -> A. Can you ping A from B? If not, network issue. If you can, disable iptables completely on A and try to use the client again from B. If that works, then your iptables are not correct. Make sure selinux is disabled/permissive on A too.

1

I found that this answer was the solution.

Basically I run the node on machine A using --rpc-addr 0.0.0.0 instead of localhost or 127.0.0.1.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.