A
A
Alexander Ivanov2021-08-10 06:56:28
Computer networks
Alexander Ivanov, 2021-08-10 06:56:28

How to communicate to two computers which are behind the NAT?

There are two computers (comp 1 and computer 2) that are each behind their own NAT'om, there is an intermediate server on which iptables is configured, so that it broadcasts packets from one computer to another. Now computer 1 has a white static address, but computer 2 does not have it, they communicate perfectly through an intermediate server. But there is no point in an intermediate server in such a scheme, but only when both computers are behind NAT, so the task is that when computer 1 is behind NAT, it must send a message to the intermediate server that it online and computer 2 can connect to it. How it is better to organize communication between two computers? How many ports to use? The same port in order to inform the intermediate server that computer 1 is online and send packets to computer 2 on the same port, Or should it be two different ports? And is it even possible to transmit all this on one port? It is computer 1 that should initiate the connection, since the task is for computer 2 to connect to computer 1.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Kuzmichev, 2021-08-10
@Assargin

NAT Traversal, STUN, TURN.
Absolutely without anything intermediate with a white address, at least purely for the initial initialization of the connection and the search for "computers" with each other - nothing.
Even in WebRTC, in the simplest case, there is a signal server through which peers exchange candidates, and sometimes it turns out without frills like STUN / TURN, but often only in an ideal world.

A
antonwx, 2021-08-10
@antonwx

Put Zerotier and no bicycles can be reinvented

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question