3

I am attempting to connect using two nodes on separate machines:

geth attach

I enter this in machine 2-

geth attach http://10.132.0.2:8501

and get this -

Fatal: Failed to start the JavaScript console: api modules: 
Post http://10.132.0.2:8501: dial tcp 10.132.0.2:8501: getsockopt: connection refused

I am not that clear on how the nodes connect either using UDP or TCP; or if http is used.

How can I debug this? Should we be using enode anyway?

The node is running on machine 1.

From machine 1 hosting the node


Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 127.0.0.1:8501          0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:8502          0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0      0 10.132.0.2:22           92.238.41.13:49637      ESTABLISHED
tcp        0    316 10.132.0.2:22           92.238.41.13:50681      ESTABLISHED
tcp        0      0 10.132.0.2:51968        169.254.169.254:80      ESTABLISHED
tcp        0      0 10.132.0.2:51944        169.254.169.254:80      CLOSE_WAIT 
tcp        0      0 10.132.0.2:22           92.238.41.13:50671      ESTABLISHED
tcp        0      0 10.132.0.2:22           92.238.41.13:50036      ESTABLISHED
tcp        0      0 10.132.0.2:51978        169.254.169.254:80      ESTABLISHED
tcp        0      0 127.0.0.1:54108         127.0.0.1:30311         ESTABLISHED
tcp        0      0 10.132.0.2:51962        169.254.169.254:80      ESTABLISHED
tcp        0      0 10.132.0.2:22           92.238.41.13:49959      ESTABLISHED
tcp6       0      0 :::22                   :::*                    LISTEN     
tcp6       0      0 :::30311                :::*                    LISTEN     
tcp6       0      0 :::30312                :::*                    LISTEN     
tcp6       0      0 :::80                   :::*                    LISTEN     
tcp6       0      0 127.0.0.1:30311         127.0.0.1:54108         ESTABLISHED
udp        0      0 0.0.0.0:68              0.0.0.0:*                          
udp        0      0 10.132.0.2:123          0.0.0.0:*                          
udp        0      0 127.0.0.1:123           0.0.0.0:*                          
udp        0      0 0.0.0.0:123             0.0.0.0:*                          
udp6       0      0 :::30310                :::*                               
udp6       0      0 :::30311                :::*                               
udp6       0      0 :::30312                :::*                               
udp6       0      0 fe80::4001:aff:fe84:123 :::*                               
udp6       0      0 ::1:123                 :::*                               
udp6       0      0 :::123                  :::*

from geth on machine 1 (running node)

admin.nodeInfo { enode: "enode://d889d565b3ddc37491d131aed1c23d0a7b30a185bb925f325c7830b2ae710bc127010487f39f32d889afd1284ea31aa893adddda2197f2763485926970620381@[::]:30312", id: "d889d565b3ddc37491d131aed1c23d0a7b30a185bb925f325c7830b2ae710bc127010487f39f32d889afd1284ea31aa893adddda2197f2763485926970620381", ip: "::", listenAddr: "[::]:30312", name: "Geth/v1.8.2-stable-b8b9f7f4/linux-amd64/go1.9.4", ports: { discovery: 30312, listener: 30312 }, protocols: { eth: { config: { byzantiumBlock: 4, chainId: 1515, clique: {...}, eip150Block: 2, eip150Hash: "0x0000000000000000000000000000000000000000000000000000000000000000", eip155Block: 3, eip158Block: 3, homesteadBlock: 1 }, difficulty: 27923, genesis: "0x702d8ca9647d171a6596a775888f71c7c0f3ddb011fbffcb921be685b2ef33b7", head: "0xa9e2d5d7e55653b9a0b47ddfa0650105a9d0e5487b6cff207d191d33cdefa830", network: 1515

Here is the connection string for node1 -

nohup geth --datadir node1/ --syncmode 'full' --port 30311 --rpc --rpcaddr 'loca lhost' --rpcport 8501 --rpcapi 'personal,db,eth,net,web3,txpool,miner' --bootnod es 'enode://601ade737b81f16abdd0ce9983b63eb12050c4ef89c46b8fdbf3e3e6c951cc02dffe 36f87200033107cf8b007355e780fba16b67d1d46603b1321f07314ea46b@127.0.0.1:30310' -- networkid 1515 --gasprice '1' -unlock 'fcad53c780a4f6c66b3daca331fe72fc6559c367' --password node1/pwdnode1.txt --mine &

3
  • To launch your geth, did you use --rpcport 8501 ? Apr 15, 2018 at 8:35
  • I just added the conn string, I think my mistake is rpcaddr? Apr 15, 2018 at 9:57
  • But if I just use geth attach what is the default? Is that IPC? What confuses me is what protocols are used and when, we have UDP, TCP, IPC, Http, and RPC. Has someone a link about this? Apr 15, 2018 at 10:27

1 Answer 1

2

Your RPC listening address is 127.0.0.1, which can only be connected from the same host.

If you need to connect from across networks, try --rpcaddr 10.132.0.2

4
  • should connected node's port be set publicly accessable?
    – alper
    Apr 27, 2021 at 12:59
  • should connected node's port be set publicly accessable? I am getting following error: Fatal: Error starting protocol stack: listen tcp IP:PORT: bind: cannot assign requested address
    – alper
    Apr 27, 2021 at 13:12
  • @alper Best to ask as a separate question Apr 27, 2021 at 13:20
  • Isn't only valid IP addresses are 127.0.0.1 or 0.0.0.0 for the --rpcaddr?
    – alper
    Apr 27, 2021 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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