O
O
OnYourLips2018-09-26 16:52:04
Computer networks
OnYourLips, 2018-09-26 16:52:04

How to implement p2p when both users are behind NAT?

There are two users and they are both behind NAT.
If one of them had an external IP, then it would be possible to raise a server on it, and a client on the second user.
What if both users are behind NAT?
It is clear that you need to put a server on the network, but driving all traffic through it is not an option. I don't see any alternative way yet. It is clear that within the framework of one connection, when responding, this server will send them to NAT, and he, knowing the port, will wrap it up to the real IP of the client. But how to initiate communication between clients?
How to be?

Answer the question

In order to leave comments, you need to log in

7 answer(s)
M
Michael Galyuk, 2018-09-27
@OnYourLips

1. NAT punching :
UDP-pounching
TCP-pounching (SYN-TCP)
For coordination, a third intermediary node is needed, and then directly.
2. IPv6 :
Can be emulated in IPv4 by Teredo (on Windows) or Miredo (on Linux) services.
3. Special protocols for routers and not only. Google for the words:
IGD (UPnP), NAT-PMP (within Bonjour), STUN, NAT-T (IKE), TURN, RSIP, MIDCOM, ICE, SBC, ALG, ICM (extension to STUN+TURN).

X
xmoonlight, 2018-09-26
@xmoonlight

As an option: a virtual peer-to-peer network with DNS-like interaction (update) to synchronize lists of active clients (they are also rendezvous servers).
The client turned on (went online) - informed his entire list that he turned on.
Answer from each (short list of fresh ones): the last 4-5 published on-line.
Permanent connection - to 5-7 other clients to establish a connection with the desired IP-shnik.
Etc.

L
Leonid, 2018-09-27
@sled

If you need to programmatically exchange messages, then you can use social networks with an API.
I myself once wrote two connectors in Python via the VKontakte API, they sent messages to each other, everything worked fine, no need to bother with specialized servers and services

N
nic777, 2018-09-27
@nic777

Good question! An example of a program where this is implemented is TeamViewer
In practice, I used UPnP, it allows you to forward ports without having admin access to the router, but the request has to be repeated regularly so that the router does not "forget" our parameters

R
Ruslan, 2019-10-19
@msHack

RetroShare easily breaks through NAT
Tox messenger easily breaks through double NAT
JAMI while damp but still usable

P
pfg21, 2018-09-26
@pfg21

depends on the traffic being forwarded.
get a cheap VPS on OpenVZ. cost from 2 bucks a year (!), but it’s better not to chase cheapness. lowendstock.com
set up interaction between services on it.

C
CityCat4, 2018-09-27
@CityCat4

No way.
This question regularly pops up and it is just as regularly given the same answer - no way. Two ordinary computers with Windows connected through ordinary Sokhov routers, or even through 3G, cannot be connected to each other in any way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question