I'm trying to create my own chain so I have a VM which is the main node that will mine all the time, so that I don't lose the chain if all the nodes are off. I want also to make my friends able to mine and send transactions on this chain, but the problem appears when I try add a new node using admin.addPeer()
and this node is on a different network from the VM network. I am able to connect two nodes if they are on the same network but I'm not able to connect two different nodes if they are on different networks.
How can I achieve that?
I think my problem is when I make the full URL using the enode, because I'm using the IP address of the node which is an internal IP, how can I make a full URL using external and internal IP address. Also, I don't have any access to the router, so I cannot configure it.
1 Answer
When you first start up geth, you will see on the right on some line enode://[whatever]
.
Copy paste the enode with the enode part down to the ip. Now replace the local ip with your external ip, then go to your other node and in the JS console, type admin.addPeer("[the enode with the externalip]")
.
Please delete the [
and ]
.
They now should be connected
-
I put the external IP but they didn't connect to each other, I think the external IP is not enough, there should be something else to distinguish the machine on the network, like port. However, I open the port using the command --port and I used a distinguish port but it didn't work also, it seems that I should configure the port on the router. Anyway, I don't have access to the router's settings.– AkefMar 16, 2020 at 10:32
admin.addPeer()
, can you see the new node if you list them withadmin.peers
? If you just add a peer,admin.addPeer()
will not give you an error if it's unreachable at the moment.