Parity Network – How to Get Enode URL to Use/Show External IP

enodeNetworkparity

When I run a (custom dev and test network) parity node on my mac from the command line, it starts up and displays my enode as enode://c2f9c6a...85b1d@192.168.0.241:99999 where the IP address is my router assigned ip 192.168.0.241.

This means that although I can connect to the bootnode peers which have been set up (I have a remote one on a VPS), and the bootnode peers record that my node is connected, no other remote nodes are able to connect to me using the enode URL that my node has.

For example, when other remote colleagues start their nodes, they also can connect to the bootnode, but are not able to discover my node nor am I able to discover them as they are also behind routers and they have the same issue. Therefore this is not a peer-to-peer network, it is centralised around the bootnode as node discovery appears not to be working.

So my question is actually two related questions, "How to get my enode URL to use/show external IP, and how can I be discoverable?", and if that is not possible then "how is peer-to-peer achieved on the public ethereum chain and can I apply it to my custom chain?".

Best Answer

There are a couple of issues here, that I hadn't outlined when I posted the question.

  1. The first is that you may have other nodes running in your LAN that you may or may not be aware of - the external IP will be the same for all of them.
  2. The second is that you should consider that being behind a router you want to route traffic to your node when it is required.
  3. The third is that the question is more or less about being discovered on the network.

The question is therefore about if you want to host a permanent node or not.

Permanent Node

One reason to host a permanent node is if you want to host a bootnode for a network that can be connected to by anyone outside your LAN. You therefore need an external IP address, and you need to assure that there are no other nodes running behind your router that will also use the external IP address if not directly at least indirectly.

This solution in Parity requires setting the --nat extip:<your_external_ip> argument when you start up the node on the command line. This will force your node to startup and create an enode using your external IP and port.

This enode can then be included in your genesis.json file and will be used by other nodes to sync to the blockchain and other stuff.

Non-permanent node

This implies that you are starting and stopping your node at any time and you don't care too much about being available to the network or not.

Here you must consider what your router is doing. In this case you need to configure your router to have the port 30303 open (for ethereum or another value for your own private network) and port forwarding enabled for this port for both TCP and UDP.

This allows your node to both communicate with the network and be discoverable (UDP).

Related Topic