geth --rpcaddr

当想要实现从另一台电脑连接本电脑上开启的geth客户端时,需要将--rpcaddr设置为本电脑的ip地址,如下:

geth --datadir data0 --networkid 1500 --port 61912 --rpc --rpcaddr 10.244.213.34 --rpcapi 'eth,net,web3,admin,personal,miner,debug' --rpccorsdomain '*' --rpcport 8202 dumpconfig > ./geth.toml 

注意不能写成:

--rpcaddr '10.244.213.34'

否则运行下面的命令的时候会报错:

Fatal: Error starting protocol stack: listen tcp: lookup 10.244.213.34--rpcapi: no such host

不带引号

然后运行:

geth --config geth.toml console 2>>geth.log

然后就可以从日志中看见看见:

tail -f geth.log

INFO [12-12|16:34:08] HTTP endpoint opened                     url=http://10.244.213.34:8202            cors=* vhosts=localhost

如果不是这样的话,从另一台电脑连接时总是报错:ERR_CONNECTION_REFUSED

原文地址:https://www.cnblogs.com/wanghui-garcia/p/10109306.html