U
U
uf03612021-01-05 14:10:37
P2P
uf0361, 2021-01-05 14:10:37

How do nodes in p2p networks bypass NAT?

How do nodes in p2p networks bypass NAT? Is this possible with a completely decentralized type of p2p network?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
shurshur, 2021-01-05
@uf0361

Yes, of course it's possible.
Part of the network has external IPs and allows direct connection to them. With the simplest implementation of p2p, a connection is possible only between participants, provided that one of them has an external IP. If node A wants to establish a connection with node B without an external IP (with a closed port, etc., what was called LowId in ed2k, passive mode in DC - and all that), then B must receive information about A and install with him connect himself.
For example, in ed2k, a client with a valid external IP and the ability to connect to it receives a HighId that is the same on all servers, and an inferior client receives a non-constant unique LowId within the server. To establish a connection between themselves, clients A and B must be on the same server, and then A asks the server to send B a request to establish a connection. Completely serverless (using DHT), ed2k can only work with HighId clients.
Some networks also support proxying, in which case data can be exchanged between any network participants. Sometimes even intermediaries are required to exclude direct data transfer and thus mask the real addresses of network participants.
The biggest problem for decentralized networks is bootstrap when first launched, the need to find at least one member of the network in order to find out the addresses of others. To do this, there is usually some kind of server with a source of the initial list of nodes, which the user prescribes manually or which is automatically polled at the first start.

I
Igor, 2021-01-22
@penetration

If the nodes know the IP addresses and ports of each other, then if they are both behind NAT, it will not be difficult for them to connect to each other.
This is called the NAT hole punching technique.
A sends UDP packets to B and B sends A at the same time.
In this case, both nodes have an entry in the NAT table that, for example, A is waiting for a response from B and vice versa, so NAT passes their requests to each other.
True, it would be nice to know each other's IP addresses and ports, for this an intermediate server with a white IP is used, for example, as a torrent tracker.
The success of NAT Hole Punching depends on the type of NAT the hosts are behind.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question