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?

2
  • 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, 2021 at 14:33
  • Did any answer help you? if so, you should accept the answer so that the question does not keep popping up forever, looking for an answer. Alternatively, you could post and accept your own answer.
    – Ron Maupin
    Dec 23, 2021 at 21:03

1 Answer 1

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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