udp through nat

Posted by youllknow on Server Fault See other posts from Server Fault or by youllknow
Published on 2010-07-15T21:20:38Z Indexed on 2010/12/26 21:55 UTC
Read the original article Hit count: 310

Hi everyone!

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.

::::EDIT::::

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): 172.16.16.100/24, GW 172.16.16.1
C2 (Client 2, WinXP Prof SP3): 10.0.0.100/24, GW 10.0.0.1
C3 (Client 3, WinXP Prof SP3): 3.0.0.2/24, GW 3.0.0.1
S1 (Ubuntu 10.04 x64 Server): eth0: 172.16.16.1/24, eth1: 1.0.0.2/24 GW 1.0.0.1
S2 (Ubuntu 10.04 x64 Server): eth0: 10.0.0.1/24, eth1: 2.0.0.2/24 GW 2.0.0.1
S3 (Ubuntu 10.04 x64 Server): eth0: 1.0.0.1/24, eth1: 2.0.0.1/24, eth2: 3.0.0.1/24

+--+     +--+     +--+     +--+     +--+  
|C1|-----|S1|-----|S3|-----|S2|-----|C2|  
+--+     +--+     +--+     +--+     +--+
                    |  
                  +--+  
                  |C3|  
                  +--+  

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 2.0.0.2"" at C1, and ""chownat -c 8000 1.0.0.2"" 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!

© Server Fault or respective owner

Related posts about networking

Related posts about routing