reth icon indicating copy to clipboard operation
reth copied to clipboard

Enable dual stack IPv6

Open barnabasbusa opened this issue 1 year ago • 9 comments

Describe the feature

Currently dual stack setups are not supported:

"node",
"--datadir=/data",
"--log.file.directory=/data/logs",
"--port=30303",
"--http",
...
"--nat=extip:147.182.168.104",
"--nat=extip:2604:a880:400:d0::2445:a001"                

It would be great if reth could advertise v4 and v6 addresses at the same time.

error: the argument '--nat <NAT>' cannot be used multiple times

Usage: reth node [OPTIONS]

For more information, try '--help'.

Additional context

No response

barnabasbusa avatar Mar 12 '24 15:03 barnabasbusa

@mattsse I'd like to take it

int88 avatar Mar 13 '24 01:03 int88

Can you expand a bit on how you intend to solve it? And are there any unknowns for you/things you need clarified?

onbjerg avatar Mar 13 '24 13:03 onbjerg

It seems like a cumbersome job.

I should find all the places that IPv4 address is used, most of them are in net pkg I guess, including inbound and outbound direction, and add IPv6 support in all these places.

Maybe I should make a todo list after I browse the relevant code.

@onbjerg WDYT?

int88 avatar Mar 13 '24 15:03 int88

I found most of the code in reth use IpAddr which support IPV4 & IPV6 by default.

Only DiscoveryArgs.addr and NetworkArgs.addr explicitly use Ipv4Addr.

Also most of the test cases only use IPV4 addresses to initialize.

After all above things are adapted, doc and command flag description should be updated as well.

@onbjerg @mattsse WDYT?

int88 avatar Mar 14 '24 09:03 int88

@int88 sorry for the delayed response,

I think what OP wants is not just ipv6 support like that, it's also the ability to specify --nat multiple times, once with an ipv4 addr and once with an ipv6 addr for example. currently we only accept 1 nat flag

onbjerg avatar Mar 27 '24 03:03 onbjerg

@onbjerg Yes, I found it as well, but seems geth also don't support multiple --nat?

int88 avatar Mar 27 '24 03:03 int88

Unfamiliar with how extip is supposed to work in the ENR, I don't know if we can advertise an ipv4 and an ipv6 address at the same time, cc @mattsse

onbjerg avatar Mar 27 '24 03:03 onbjerg

This issue is stale because it has been open for 21 days with no activity.

github-actions[bot] avatar Apr 18 '24 01:04 github-actions[bot]

This issue is stale because it has been open for 21 days with no activity.

github-actions[bot] avatar May 10 '24 01:05 github-actions[bot]

My experience with Geth before has been not to use "nat" with IPv6. Let it autodiscover, otherwise it either sets up only on IPv4 or something like that happens. I'm now running Reth with

--enable-discv5-discovery --addr :: --discovery.v5.port 30304 --discovery.v5.port.ipv6 30304

Open and forward ports 30303/tcp 30303/udp 30304/udp

As long as you have v4 NATted properly it should work and detect both IPs.

totoCZ avatar Sep 24 '24 11:09 totoCZ