【发布时间】:2020-07-16 16:16:17
【问题描述】:
我在本地网络(单独的机器)上运行 geth。卷曲到 http://localhost:8545 工作得很好。如何从我的专用网络上的另一台机器卷曲到该 geth 节点?卷曲到http://10.x.x.x:8545 只是返回连接被拒绝。
geth 本身在另一台 10.x.x.x 机器上运行良好,geth attach、curl 等都在该机器上的 localhost 上运行。
例如这行得通:
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' http://localhost:8545
result: ➜ {"jsonrpc":"2.0","id":67,"result":"Geth/v1.9.17-unstable-5b081ab2-20200714/darwin-amd64/go1.13.6"}
this fails (from another machine on that private network):
curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":67}' http://10.x.x.x:8545
result ➜ curl: (7) Failed to connect to 10.x.x.x port 8545: Connection refused
(当然使用真实 IP 而不是 x)
另外两个节点都可以正常通信(ssh、浏览网站、文件共享等)
【问题讨论】: