Jump to content

  • Log In with Google      Sign In   
  • Create Account

NAT Punch Through Protocol


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Rasterman   Members   -  Reputation: 206

Like
0Likes
Like

Posted 19 June 2012 - 08:44 AM

When doing punch through what is a good TTL to use when sending the punch messages? I'm currently using a value of 5, is that good? Also does the data or frequency matter? My current scheme is to send 5 messages every 100ms containing the words "punch through" with a TTL of 5. After sending 5 messages I then wait 500ms and try to connect. Is this good?

Sponsor:

#2 hplus0603   Moderators   -  Reputation: 5725

Like
1Likes
Like

Posted 19 June 2012 - 11:38 AM

That'll probably work fine. You typically only need one datagram, not 5, but can't hurt :-) Using short-TTL for the first packet is a work-around for certain broken firewalls/routers that "blacklist" certain incoming traffic, so you're already doing better than the "default" implementation.
Also, you might want to ramp the TTL. Send with TTL 2 in the first packet, TTL 3 in the second packet, ...
The most important part is to make sure both ends have sent out their short-lived punch packets before they try to send the actual payload data.
enum Bool { True, False, FileNotFound };

#3 Rasterman   Members   -  Reputation: 206

Like
0Likes
Like

Posted 21 June 2012 - 02:07 PM

Ok so I tested my first real punch through between two Win 7 machines, both running windows firewall and both have NAT routers/firewalls as well. Results were mixed, I couldn't connect at all to my friend at first (who didn't have any windows firewall rules setup), so then he tried to connect to me and it worked right away (which I have windows firewall excpeptions for my app), then I tried to him again and it took a few tries but worked eventually. It doesn't appear this punch through technique works with windows firewall or should it?

(neither of us have any rules in our NAT/routers, so it is penetrating the NAT properly, my guess is its getting hung up on his windows firewall, strange that it worked the second time though after repeated attempts, maybe I need to increase my timeouts)

(using the enet lib)

Edited by Rasterman, 21 June 2012 - 02:09 PM.


#4 hplus0603   Moderators   -  Reputation: 5725

Like
0Likes
Like

Posted 21 June 2012 - 08:37 PM

It doesn't appear this punch through technique works with windows firewall or should it?


Windows Firewall will shut down anything that hasn't gotten an exception. There is an IFwConfig interface (or similar -- I forget the exact name) and you're supposed to register an exception for your application as part of your installation package.
This is one of many reasons why "software installation" on Windows is more than just dropping an EXE and some files in the right place -- you really need a proper MS Installer (.msi) package to do it right.

enum Bool { True, False, FileNotFound };

#5 Rasterman   Members   -  Reputation: 206

Like
0Likes
Like

Posted 22 June 2012 - 12:16 AM

I use the NSIS installer and have found a plugin SimpleFC to add the windows firewall exception, thanks :)

#6 hplus0603   Moderators   -  Reputation: 5725

Like
0Likes
Like

Posted 22 June 2012 - 01:33 PM

I use the NSIS installer and have found a plugin SimpleFC to add the windows firewall exception, thanks :)


The NSIS installer does Windows Installation Wrong in general. I highly recommend upgrading to WiX.

enum Bool { True, False, FileNotFound };




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS