P2P connection over all NAT types

826 views Asked by At

Recently I am working on a p2p application and i found out how to program UDP holepunching with c# using ICE and STUN protocols.

Its good but there is some limits for symmetric NATs and routers using symmetric NAT.\

I am looking for a way to connect two system over any NAT type .

Anyway I have tried UPNP and port forwarding too but due to firewall and router blacklist this option is out of my mind, if its your answer please describe how should I use this method correctly.

Thanks in advance.

1

There are 1 answers

2
tyChen On BEST ANSWER

Upnp and NAT-PMP are quite useful for those routers which support these protocols, I haven't meet any problem like "firewall and router blacklist".

In circumstances that router doesn't support those protocols, ICE is what I use. As you said, symmetric NAT is a type that keeps highest security, and if the port increases randomly it is hard to punch a hole. Using a server as a relay (ICE can do it) is much easier than overcome random algorithm.

If you are interested in the source code of symmetric NAT, it is in some file like nf_nat_core.c, it's easy to trace and understand how it works.