ethereum / go-ethereum

Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
47.8k stars 20.24k forks source link

Support IPv6 mainnet P2P discovery bootstrap #23263

Open balboah opened 3 years ago

balboah commented 3 years ago

Rationale

It seems to me it's not possible to discover nodes on IPv6 while synchronizing with mainnet. Having IPv6 available would improve connectivity as NAT is unnecessary.

All mainnet bootnodes seems to specify IPv4 only, which may be the reason why no IPv6 peers can be found.

I also noticed there are no IPv6 address anywhere in "admin.nodeInfo", even when deleting the IPv4 address leaving no default IPv4 route (it would find 127.0.0.1 instead).

Implementation

Assuming there is actual IPv6 support in the geth P2P mechanism, perhaps providing IPv6 addresses on the bootnode instances would be enough?

fjl commented 3 years ago

This issue came up in our triage discussion today. At this time, providing IPv6-enabled bootstrap nodes is a bit tricky. Let me explain:

Discovery Protocol v4, which is currently used by Ethereum, only allows advertising a single IP address for each node. The announced address can be IPv4 or IPv6. In order to provide bootstrapping for IPv6, we would need to run a dedicated v6 node. Even if we had such nodes, connectivity between the two networks would be limited by the fact that not everyone is able to communicate with IPv6 nodes.

For these reasons, I believe that trying to make IPv6 work with Discovery v4 is a lost cause. An IPv6-only deployment of the protocol would work, but the world is not ready for it.

Discovery Protocol v5, which is used by eth2, handles this much better. In the newer discovery protocol version, nodes can announce both IPv4 and IPv6 addresses (and ports) simultaneously. We will eventually upgrade the eth1 peer-to-peer network to Discovery v5 and when we do that, we can think about proper IPv6 deployment again.