Does the NAT UDP port depend only on src ip/port?

Suppose I have a two networks connected via a NAT/router using Source NAT.

PC A ( in Network A (with router sends a UDP packet to PC B ( in Network B (with router In Network A the packet has src ip/port and dst In Network B it becomes src ip/port (because 6000 is free for whatever reason, just for the example's sake) and dst

Then PC A sends another UDP packet from src ip/port to a different PC in Network B. The source port in Network A is the same, but will it also be the same in network B (6000 in this example)? I assume yes, but I am not sure.

Does it depend on the dst ip/port as well? If not, does it mean one PC, even one src port in Network A, can use up all the NAT hash table entries in Network B? (I hope it takes at least 65536 Network A src ports to fill up the NAT hash table entries in Network B.)

BTW: This question was moved from Stack Overflow, as I think it fits here better.

2 Answers 2


In your case, it's "NAT overload" (or PAT, NAPT).
It's all about ensuring the uniqueness of the translation entries(local-src ip:port ==> global-src ip:port)

So to answer your questions:
1- If the translation table already contains the following entry: ==> (just for the example's sake), all outgoing connections from will be translated to So your assumption is correct.

2- It depends on the local src-ip and src-port.
So yes, with a theoretical maximum of 65536 PAT entries, 1 device with 65536 outgoing connections from different src-ports, or one src-port from 65536 devices, could fill up the translation table.
In practice, that limit might be reduced by:
- Memory, CPU, available ports(static-PAT/PAR), ...


Current reccomendations are that NAT mappings are Endpoint Independent. That is all packets from the same private client IP/port/protocol use the same public client IP and port even if the desinations are different.

However there is no gaurantee that every NAT you find in the wild will do this. Some may do their translations based on the full 4-tuple (known as a "symmetric NAT").

Particuarlly insiduous are symmetric NATs with port-preserving behaviour. Under light load with random source ports on the client the mappings will appear to be endpoint independent. However if multiple clients on different machines use the same source port the true nature of the NAT will become apparent. I belive linux NAT falls into this category though i'm not positive on that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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