-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TIP-549: P2P support IPv6 protocol #549
Comments
basically, this issue is to enable the IPV6 address supported by Libp2p, but as introduced a lot of advantages of IPV6, why still prefer IPV4 when two nodes support both IPV4 and IPV6? |
The main purpose of supporting IPv6 is to expand the applicability of libp2p. All fullnodes of java-tron support IPv4 now, we should first meet the current demand. We might be able to specify the priority manually later. |
So all nodes will let both IPv4 and IPv6 ports standby by default? |
Well, as long as there is IPV6 and IPV6 connection such as A and B only support IPV6, it should be compatible with the whole network, this answer does not really convince me of not using IPV6 if A and B all support dual IP stack. |
I don't quite understand what you mean, can you explain it ? |
Hi, I think this issue just meant to add support to IPV6 at the first time, whether it works steady or fragile is hard to tell now. However IPV4 has been proved to be trusted. That's why it is not widely adopted so far, if IPV6 connection works well, I suppose the dev will consider to switch all connection to IPV6 if node supports. |
@WalterBrooks Totally agreed. As a config item in the client of a decentralized network, no one can make sure all nodes enable IPv6 in succession or whatever, but the devs have to guarantee the network keeps running without exceptions. IPv4 does that, no matter the other node support which stack, but IPv6 does not. It is an ongoing business, they have to make sure IPv6 works perfectly, and then mandatory updates could make all nodes support IPv6. |
Supporting IPv6 is indeed a modern and trendy idea. Just have one small question, if IPv6 has so many benefits, why still prefer IPv4 when both nodes support IPv6 & IPv4? |
Close this issue as it is implemented by GreatVoyage-v4.7.2. |
Simple Summary
This document describes how to support nodes with IPv6 stack in libp2p network.
Abstract
Libp2p support connection between IPv6 nodes to expand usage scenarios and provide adaptability, we prefer to use IPv4 to be suitable for most scenarios if nodes supoort both IPv4 and IPv6.
Motivation
IPv6 has some major advantages over IPv4:
Those are some of the major advantages of IPv6 over IPv4. IPv6 is the future of the Internet and support for IPv6 is growing steadily. So libp2p should support nodes with IPv6.
Specification
If a node supports dual IP protocol stacks and does not specify a listening IP when starting a UDP or TCP server, then both IPv4 and IPv6 ports are open at the same time, and both IPv4 and IPv6 connections can be accepted at the same time. IPv6 only refers to WAN IPv6, don't include LAN IPv6. Generally, nodes with IPv4 addresses and nodes with IPv6 addresses cannot connect because the packet headers are inconsistent. Unless the IPv4 network actively accesses the IPv6 network through NAT64 static mapping.
IP Stack Preference
Each node can be represented:
We prefer to use IPv4 if a node support both IPv4 & IPv6. This is the UDP & TCP connection preference between two nodes:
We consider three steps that how IP stack works in libp2p.
Step 1: Address exchange & synchronization (UDP)
Suppose nodes A and B both support IPv4 and IPv6. Node B has configured Node A's IPv6 in its seed node.
The key point is how node deduplicates and updates the IP according to the key. If exists a node P with a dual IP protocol stack, for any other node Q, there are only four possible received sequences to know P:
If the following two situations occur, they cannot be recognized as the same Node:
Therefore, do not add a node's IPv4 and IPv6 at the same time in the configuration file. Otherwise, it may not be recognized as the same node and cannot be deduplicated.
Step 2: Find neighbors (UDP)
Following the last step, B finds that A supports dual protocol stacks, and also supports dual protocol stacks itself. According to the IPv4 priority principle, send a FindNeighbor message to A through IPv4.
After receiving the FindNeighbor message, A finds that nodeHandler already exists according to the key obtained by Node. When sending a Neighbor packet, the IP stack sent must be consistent with the IP stack received.
Let's suppose other conditions.
Case 1: Assume that node A has dual protocol stacks and node B only supports IPv6. Node B starts the server and includes A's IPv6 address in its seed list.
For compatibility reasons, the two Nodes can only communicate through IPv6.
Case 2: Both A and B are dual-stack nodes, and B obtains node A from other nodes' Neighbor packets. Since IPv4 is preferred, all packets go through the IPv4 protocol stack.
Step 3: TCP connection
Other
1. How to find out whether my node supports IPv6?
You can use this command to get your WAN IPv6, not including the LAN address, such as loopback, etc.:
2. How to express IPv6 in config file?
You should use [IPv6]:port or IPv4:port in the config file.
3. How to test IPv6 connection?
Or
4. How to use IPv6 in java-tron?
Use code version v4.7.2 or later and config this item in config.conf.
The text was updated successfully, but these errors were encountered: