[zeromq-dev] P2P network and NAT traversal

Goswin von Brederlow goswin-v-b at web.de
Mon May 19 11:50:26 CEST 2014


On Sat, May 17, 2014 at 11:17:48AM -0400, Brian wrote:
> Is there any way to use ZMQ when both clients and servers are behind NAT like a p2p network? It seems UDP is not supported. Would a pubsub model work or only if the server is not behind NAT?
> Sent from my iPhone
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

With both behind nat there is no way to connect. You need to open a
port in the firewall and forward a port for this to work.

For UDP there is a hack that circumvents the firewall/nat: hole punching.

Normaly outgoing traffic is allowed and any outgoing UDP traffic also
alows for replies to come back. So what you do is you "blindly" send
some UDP traffic from both side to the other side at the same time.
This opens up the firewall / nat on both sides and suddenly client and
sever can talk to each other.

You can't do it completly "blindly". You have to know the IP of the
router and the port the other side is going to use and you have to
time it so both sides fire at roughly the same time. So usualy you
have a 3rd party that is not behind NAT that both sides connect to and
then coordinate the hole punching.

But none of that works for tcp. You need to forward a port for tcp.

MfG
	Goswin



More information about the zeromq-dev mailing list