Choosing port number for UDP hole-punching -
i have weird problem. have working c++ (boost asio) p2p application works on of nat. problem when give initial start port number 1000 checks if 1000 free else increment 1 , chooses port , starts handshaking. when have 10000, 20000, or other huge port number hole punching doesn't work on port restricted cone nat.
how possible? pretty sure nothing code. , doesn't work on 1 of friends' full cone nat well, has worked in many other full cone nats. reason? there missing how nat behaves?
in many nat implementations, there protection rules in place prevent 1 host tying large percentage of ports on wan interface, e.g. described here.
depending on router, nat table entries have different lifetimes, , there limits on how many ports can allocated single client (i've seen numbers 128 4096).
so think when point need use high ports, nat table source ip address full (or full) entries old connections, or connections other apps, router either decides decline or can't fit new nat entry port.
however, sure, try repeat on controlled environment collecting wireshark dumps on both sides of nat , analyze packets. if possible, helpful enable router logs , peek them.
i understand not "magic bullet", hope somehow helps you.
Comments
Post a Comment