0

Suppose I use a STUN server (UDP) to determine that a client's NAT randomly assigns external port values.

Does this imply that the client's NAT will also assign random external port values when using TCP?

Or, is the answer indeterminate since there is no standardization?

In general: Can I use the NAT port prediction determination from UDP to extrapolate the NAT port prediction for TCP?

1
  • By NAT, I assume you mean the NAPT variant that involves transport protocols because basic NAT does not involve transport port numbers. NAPT maintains a table for each of TCP, UDP, and ICMP, which are the only protocols supported. Each table is basically handled the same way, although each protocol has some individual requirements for translation.
    – Ron Maupin
    Jul 28 at 14:33
1

In general: Can I use the NAT port prediction determination from UDP to extrapolate the NAT port prediction for TCP?

No, most likely not. The way to select outgoing port numbers for DNATed clients is at the NAT router's discretion, either by software implementation or (sometimes) by configuration. Even if you succeed in guessing correctly in some cases your guesses can become wrong at any time.

Additionally, a TCP socket not only requires some way to 'get into' the mapped port but the source/destination IP address/TCP port need to match a mapping on both the NAT router and the end node - so even guessing correctly won't help (as far as I understood your question).

I assume you've got an XY problem - a how-do-I-get-into-that-NATed-network? situation is most reliably resolved by employing an external, easy-to-reach rendezvous server.

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.