erlang-libp2p icon indicating copy to clipboard operation
erlang-libp2p copied to clipboard

IPv6 Support

Open terrancewong opened this issue 3 years ago • 9 comments

Is there any way to let the node/miner listen to IPv6?

Currently a connect to IPv6 peer

<prog> peer connect /ip6/240e:xxxx:xxxx::xxx/tcp/44158

returns

Failed to connect to "/ip6/240e:xxxx:xxxx::xxx/tcp/44158"

terrancewong avatar Sep 15 '21 06:09 terrancewong

@PaulVMo does the listen address thing allow ipv4 addresses to be specified?

evanmcc avatar Sep 15 '21 23:09 evanmcc

Yes, the listen_addresses parameter in sys.config allows ip4 and ip6 address. I did test to confirm it will listen on ip6 address. I never did try peer connect however.

PaulVMo avatar Sep 15 '21 23:09 PaulVMo

Yes, the listen_addresses parameter in sys.config allows ip4 and ip6 address. I did test to confirm it will listen on ip6 address. I never did try peer connect however.

ipv6 will not work today. It'll need quite a bit more than being able to just specify listen addresses

madninja avatar Sep 15 '21 23:09 madninja

@madninja if one want to working on ip6 support, thoughts on where to start?

PaulVMo avatar Sep 16 '21 00:09 PaulVMo

@PaulVMo does the listen address thing allow ipv4 addresses to be specified?

lsof -i tcp shows an IPv6 LISTEN on 44158

terrancewong avatar Sep 16 '21 10:09 terrancewong

@PaulVMo does the listen address thing allow ipv4 addresses to be specified?

lsof -i tcp shows an IPv6 LISTEN on 44158

Did you set the listen_addresses parameter or are you running this on docker? I have noticed that docker's bridge network will publish listening ports on both ip4 and ip6. However, the miner is actually only listening on ip4 by default inside the container.

Anyway, like madninja said, while it may listen on am ipv6 address, there are other issues preventing the node for working with an ipv6 address.

PaulVMo avatar Sep 16 '21 14:09 PaulVMo

it's a docker, alias bcem='balena -D container exec $MINER''

# bcem ip a 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
9: eth0@if10: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UP 
    link/ether <MAC> brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.3/16 brd 172.17.255.255 scope global eth0
       valid_lft forever preferred_lft forever
DEBU[2021-09-17T00:57:37.818834576Z] [hijack] End of stdout 

terrancewong avatar Sep 17 '21 01:09 terrancewong

Unless you have enabled ipv6 support in docker and updated the listen_addresses in the sys.config file in the miner (inside the container) is not actually listening on ipv6. What you are seeing in lsof is the docker network bridge listening on ipv6 not the miner itself.

PaulVMo avatar Sep 17 '21 13:09 PaulVMo

I opened a PR for some fixes for ipv6 support that resolve the miner peer connect /ip6/.... errors. However, ipv6 probably still needs more work before . For example, NAT status is not set when only listening on ip6. Also, selection of gossip peers does not consider available protocols.

PaulVMo avatar Sep 23 '21 15:09 PaulVMo