I've two private networks (each of them behind a typical dsl router). The routers are connected to the WWW. The extern interface of each router have one dynamic IP address. I want to stream data via UDP directly between one client in private network A and one client in private network B.

I've already tried a lot of things (see: http://en.wikipedia.org/wiki/UDP_hole_punching, or STUN). But it wasn't possible for me to transfer data between the two clients.

It's possible to use a server (located in the WWW, with static IP) to transfer the extern IPs (and extern ports) from the routers between the clients. So imagine client A knows client B's external IP and client B's external port assigned by his router.

I simply tried sending UDP packet to the receivers external IP/port combination, but without any result. So does anyone know what do to communicate via UDP throw the two NAT routers? It must be possible??? Or does Skype, for example, not directly communicate between the clients when the call eachother (voice over ip).

I am sorry for my bad English! If something is confusing don't mind asking me!!!

Thanks for your help in advance.


I can't get pwnat or chownat working.
I tried it with my own dsl-gateway -> didn't work.

Then I set up a complete virtual environment using VMWare.

C1 (Client 1, WinXP Prof SP3):, GW
C2 (Client 2, WinXP Prof SP3):, GW
C3 (Client 3, WinXP Prof SP3):, GW
S1 (Ubuntu 10.04 x64 Server): eth0:, eth1: GW
S2 (Ubuntu 10.04 x64 Server): eth0:, eth1: GW
S3 (Ubuntu 10.04 x64 Server): eth0:, eth1:, eth2:

+--+     +--+     +--+     +--+     +--+  
+--+     +--+     +--+     +--+     +--+

Server S1 and S2 provide NAT functionality. (they have routing enabled and provide a firewall, which allows trafic from the internal net and provide the nat functionality) Server S3 has routing enabled. The client firewalls are turned off.

C1 and C2 are able to ping C3, e.g. visit C3's webserver. They are also able to send UDP Packets to C3 (C3 successful receives them)!

C1 and C2 have also webservers running for test reasons.

I run ""chownat -s 80"" at C1, and ""chownat -c 8000"" at C2. Then I tried to access the Webpage from C1 via webbrower localhost at port 8000. It didn't work.

Can anybody help me? Any suggestions? If you have any questions to my question, please ask!

migrated from stackoverflow.com Jul 16 '10 at 12:56

This question came from our site for professional and enthusiast programmers.

  • Why didn't STUN work? It's whole purpose is to do what you want to do. – womble Aug 27 '11 at 4:53

For a simple windows based application you can try Logmein Hamachi.

For a more advanced solution for NAT to NAT connection udp/tcp look at pwnat.


solved... UDP Hole punching techniques work! It was an implementation error!

  • what did you use for the transfer (over UDP)? – rogerdpack Sep 13 '11 at 18:48

Try any of:

  1. Setup your DSL gateways to forward received UDP packets on a particular port directly to the host in question

  2. Setup IPv6 tunnels on your internal nodes, then you'll be able to communicate directly

  • I have no access to configure the dsl gateways. – youllknow Jul 21 '10 at 17:19
  • Then you cannot do it without some sort of external tunnel broker. – MikeyB Jul 21 '10 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.