0

I'm in the process of creating a private Ethereum network. I am able to successfully connect nodes on my local machine but unable to connect nodes in my LAN or outside my network.

When I run a geth node for example

geth --datadir data/node-1 --networkid 8572054696  --rpc --rpcaddr "0.0.0.0" --rpccorsdomain "*"  --port 30303 --rpcapi admin,debug,eth,miner,net,personal,txpool,web3 --ipcdisable --nodiscover --allow-insecure-unlock

One of the output fields will be

INFO [09-03|12:18:47.132] Started P2P networking                   self="enode://294ea3783e96cb2b17de38fb1d574dab85246b63a949bcc5fc291d7b4df2a4a16b1f55fd4e14656e8bb337116c43e86a8e71db4d36b7856106f205ea342cf90b@127.0.0.1:30301?discport=0"

Notice the ip address is my localhost 127.0.0.1

However when I attach a geth node instance in a difference command tab and run

admin.nodeInfo.enode

I get the same node url with my public ip address

enode://294ea3783e96cb2b17de38fb1d574dab85246b63a949bcc5fc291d7b4df2a4a16b1f55fd4e14656e8bb337116c43e86a8e71db4d36b7856106f205ea342cf90b@{publiIP}:30301?discport=0

When I run a different node on the same machine and then open up a geth instance and run

admin.addPeer("enode://294ea3783e96cb2b17de38fb1d574dab85246b63a949bcc5fc291d7b4df2a4a16b1f55fd4e14656e8bb337116c43e86a8e71db4d36b7856106f205ea342cf90b@127.0.0.1:30301?discport=0")

It successfully adds the peer when using the localhost ip not my public ip and now I have a peer count of 2 Why are the ip addresses different? How can I successfully add peers within my local home network and also outside my home network. If I try adding a peer on another machine inside my network with same genesis file it returns true but actually doesn't add the peer.

Are there any good resources out there that explain how to configure your router or network settings so other nodes can join your network using addPeer()?

I've seen plenty of tutorials on how to create a private network using your localhost/same machine but nothing with comprehensive information setting up a network using only geth and having it publicly available. Again any info is appreciated.

Your Answer

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

Browse other questions tagged or ask your own question.